你传的没错啊 ,但是 imgObj[i] 是在哪里定义的呢?

解决方案 »

  1.   

    当然错了,function里面不能用imgArr[i],要用this!至于imgObj[i]是哪里冒出来滴?!这是错误演示!
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title> new document </title>
        <meta name="generator" content="editplus" />
        <meta name="author" content="Gao YiXiang" />
        <meta name="email" content="[email protected]" />
        <meta name="keywords" content="javascript dhtml dom" />
        <meta name="description" content="I love web development." />
    </head>
    <body>
        <input type="text" id="" value="1" />
        <input type="text" id="" value="2" />
        <input type="text" id="" value="3" />
        <script type="text/javascript">
        <!--
    var txtArr = document.getElementsByTagName("input");
    for (var i=0; i<txtArr.length; i++)
    {
        txtArr[i].onclick = function()
        {
            if (txtArr[i].type == "text")
            {
                showValue(txtArr[i]);
            }
        };
    }
    function showValue(oTarget)
    {
        alert(oTarget.value);
    }    //-->
        </script>
    </body>
    </html>
    这是正确滴演示!
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title> new document </title>
        <meta name="generator" content="editplus" />
        <meta name="author" content="Gao YiXiang" />
        <meta name="email" content="[email protected]" />
        <meta name="keywords" content="javascript dhtml dom" />
        <meta name="description" content="I love web development." />
    </head>
    <body>
        <input type="text" id="" value="1" />
        <input type="text" id="" value="2" />
        <input type="text" id="" value="3" />
        <script type="text/javascript">
        <!--
    var txtArr = document.getElementsByTagName("input");
    for (var i=0; i<txtArr.length; i++)
    {
        txtArr[i].onclick = function()
        {
            if (this.type == "text")
            {
                showValue(this);
            }
        };
    }
    function showValue(oTarget)
    {
        alert(oTarget.value);
    }    //-->
        </script>
    </body>
    </html>
      

  2.   

    lz滴代码可以这样改一下试试看!L@_@K
    imgArr[i].obj = imgObj[i];imgArr[i].onreadystatechange=function(){ 
        if(this.readyState=="complete"){ 
            imgLoad(this.obj,this); 
        } 
    }