firefox 不支持onmouseover里的函数带参数?
写了段代码用来让鼠标相应onmouseover事件时浮现出一个div. 可是只能在IE下运行, 在firefox下无反应.
<script language= "javascript ">
function ShowDiv(countryid, vartop, varleft){
countryid.style.top=event.clientY + vartop;
countryid.style.left=event.clientX + varleft;
countryid.style.visibility= "visible ";
countryid.style.filter= "Alpha(Opacity=70) ";
}
function HiddenDiv(countryid){
countryid.style.visibility= "hidden ";
}
</script>
<body>
<img src= "newmap.png " width= "655 " height= "600 " border= "0 " align= "absmiddle " usemap= "#Map ">
<map name= "Map ">
<area shape= "circle " coords= "88,526,6 " href= "# " target= "_self " onmouseover= "ShowDiv(ID_PORTUGAL,-170,20) " onmouseout= "HiddenDiv(ID_PORTUGAL) ">
<area shape= "circle " coords= "220,503,6 " href= "# " target= "_self " onmouseover= "ShowDiv(ID_SPAIN,-170,20) " onmouseout= "HiddenDiv(ID_SPAIN) ">
<area shape= "circle " coords= "252,378,6 " href= "# " target= "_self " onmouseover= "ShowDiv(ID_FRANCE,-130,20) " onmouseout= "HiddenDiv(ID_FRANCE) ">
.........................
之所以要在ShowDiv()中加入参数是因为有好几个div要做分别处理. 调试时发现好像firefox根本不支持带参数的ShowDiv()传值给onmouseover, 很是郁闷.
如何能让此程序也在firefox下成功显示呢?
请高手指教, 谢谢
------解决方案--------------------兄弟,FireFox是支持带参数的。我的例子如下:
<script type= "text/javascript ">
function ss(n1,n2,n3){alert( "n1: "+n1+ " n2: "+n2+ " n3: "+n3)}
</script>
<input type= "submit " value= "提交 " onmouseover= "ss(11,22, '33 ') " />
你的问题的原因应该是其它错误!
例如countryid.style.top=event.clientY + vartop;
应该改为countryid.style.top=event.clientY + vartop + "px ";
等等之类的错误。