那有这样定义对象的?总感到你的对象怪怪的,改一下:<script>
function eles()
{
this.aa="a";
this.cc="c";
}
eles.prototype.to=draw;
function draw()
{
document.write("<table><tr><td>test laker</td></tr></table>");
document.write("<br>"+this.aa+"<br">+this.cc);}function addeles()
{
nod=new eles;
nod.to();
}</script><input type="button" value=addeles onclick="addeles()">

解决方案 »

  1.   

    結果是:
    test laker 
    false我要的是:
    test laker 
    a
    c
      

  2.   


    <script>
    function eles()
    {
    this.aa="a";
    this.cc="c";
    }
    eles.prototype.to=draw;
    function draw()
    {
    document.write("<table><tr><td>test laker</td></tr></table>");
    document.write("<br>"+this.aa+"<br>"+this.cc);}function addeles()
    {
    nod=new eles;
    nod.to();
    }</script><input type="button" value=addeles onclick="addeles()">你看看,这就对了。你写错一个地方了,看见没有???
    document.write("<br>"+this.aa+"<br">+this.cc);
    ==>
    document.write("<br>"+this.aa+"<br>"+this.cc);搞的我也患你的错误。你看我改后的结果对不。我测试是正确的!