兄弟,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";
等等之类的错误。
<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";
等等之类的错误。
解决方案 »
- 哪位大神进来帮我解决这个下拉列表的问题
- Android平台的应用商店该怎么做???
- 贪吃蛇游戏的问题 纠结!!
- 几个很变态的BUTTON
- 怎么引用.js? 气死我了!
- 如何循环得到总金额?................如何循环得到总金额?................非常感谢大家
- 请教高手们,一个在javascript中用alert显示提示框的问题
- 如何给DataGrid中的数据列添加下拉菜单
- How to change lowercase letter to uppercase (for netscape)?Thanks!
- 这段加密JS怎么解~!
- 请教个JS关于setTimeout的问题
- 怎么用JS实现把图像导出到excel?
这个参数看着似乎有问题countryid.style.top=event.clientY + vartop;
这一句也有问题
在ie中event可以代指window.event但是在firefox里面event是与ie有不同的使用规则的
向如你这样直接在html代码的里面加入事件句柄的
如果函数没有参数
则.firefox事件处理函数调用时,默认传递一个event参数进去
这样,你的代码就是有效的
但是一旦你使用了参数,则firefox不传递这个event
你的代码就出错了<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)">根据这几行来看
在不同的area上触发事件,会给句柄不同的参数
何不给area加上ID属性然后,去掉事件句柄中的参数
然后在事件处理函数中,使用window.event.target.id(IE下是使用event.target.id)
获取触发事件的元素ID
然后根据ID的不同来执行不同的代码
可以使用Eval来合成动态代码执行的
1. "px"对于firefox是必须的.
2. event参数对于onmouseover中的函数也是必须的, 函数可以带参数, 但对于firefox而言, 必须有event参数.搞定了, 我最后的解决方案:
function ShowDivEvent(e, thisDiv, varTop, varLeft){
mx = e.clientX || e.pageX;
my = e.clientY || e.pageY;
thisDiv.style.top = my + varTop + "px";
thisDiv.style.left = mx + varLeft + "px";
thisDiv.style.visibility="visible";
thisDiv.style.filter="Alpha(Opacity=70)";
}function HiddenDivEvent(thisDiv){
thisDiv.style.visibility="hidden";
}<body>
<img src="newmap.png" width="655" height="600" border="0" align="absmiddle" usemap="#Map">
<map name="Map">
<area id = "AREA_PORTUGAL" shape="circle" coords="88,526,6" href="#" target="_self" onmouseover="ShowDivEvent(event, document.getElementById('DIV_PORTUGAL'),-170,20)" onmouseout="HiddenDivEvent(document.getElementById('DIV_PORTUGAL'))">
....................................吃水不忘打井人, 每人30分!!!
再次感谢!!!