the_image.src = the_new_image;为什么不是window.document.sun1.src = the_new_image;<script type="text/javascript">
function facuSwap(the_image,the_new_image,the_url)
{
the_image.src = the_new_image;
var my_window = window.open(the_url,my_window,'height=300,width=150');
}
</script>
</head><body>
<img src="01.jpg" name="sun1" border="0"
onMouseOver="facuSwap(window.document.sun1,'011.jpg','http://www.qq.com/');" 
onMouseOut="window.document.sun1.src='01.jpg';" />
<br />
<img src="02.jpg" name="sun2" border="0"
onMouseOver="facuSwap(window.document.sun2,'022.jpg','http://www.baidu.com/');" 
onMouseOut="window.document.sun2.src='02.jpg';" />

解决方案 »

  1.   

    window.document.sun1.src='01.jpg'改成document.sun1.src='01.jpg'也可以啊 你试了吗?我在ff和ie9下没问题
      

  2.   


    是the_image.src = the_new_image;为什么不是window.document.sun1.src = the_new_image;
      

  3.   

    在定义一个函数时,写在括号中的是形参(形式参数);在调用时,需要向函数传递对应的实参(实际参数)。举个最简单的例子来说:
    函数的定义就是制定一种运算规则,比如规定某个函数需要两个参数x、y,计算并返回这两个操作数的和,那么函数的定义是这样的
    function sum(x, y) { //括号中的x、y就叫形式参数
        return x + y;
    }函数定义好以后,接下去就要利用这个函数分别计算1 + 2的和,也就是调用sum函数:
    alert(sum(1, 2)); //这里sum括号中的1、2就是实际参数,分别传递给sum函数的x、y变量