IE能运行,但在FF中运行不了
我想做的是五个按钮,点击任意一个按钮时,会有一个与该按钮匹配的DIV出现在鼠标附近,五个按钮对应五个不同的DIV。代码如下:
<html>
<head>
<meta name= "generator " content= "HTML Tidy, see www.w3.org ">
<meta http-equiv= "Content-Type " content= "text/html ">
<script type= "text/javascript ">
function showDiv(oEvent,oThis){
var oDiv=document.getElementById( "div "+oThis.name);
oDiv.style.visibility= "visible ";
oDiv.style.left=oEvent.clientX-30;
oDiv.style.top=oEvent.clientY+20;
for(var i=1;i <6;i++){
if(i==oThis.name){
continue;
}
var oDiv1=document.getElementById( "div "+i);
oDiv1.style.visibility= "hidden ";
}
}
</script>
<title> </title>
</head>
<body>
<div>
<input type= "button " value= "kkkk1 " name= "1 " onclick= "showDiv(event,this) ">
<input type= "button " value= "kkkk2 " name= "2 " onclick= "showDiv(event,this) ">
<input type= "button " value= "kkkk3 " name= "3 " onclick= "showDiv(event,this) ">
<input type= "button " value= "kkkk4 " name= "4 " onclick= "showDiv(event,this) ">
<input type= "button " value= "kkkk5 " name= "5 " onclick= "showDiv(event,this) ">
</div>
<div id= "div1 "
style= "background-color:green;position:absolute;visibility:hidden "> welcome
</div>
<div id= "div2 "
style= "background-color:red;position:absolute;visibility:hidden "> welcome
</div>
<div id= "div3 "
style= "background-color:yellow;position:absolute;visibility:hidden "> welcome
</div>
<div id= "div4 "
style= "background-color:blue;position:absolute;visibility:hidden "> welcome
</div>
<div id= "div5 "
style= "background-color:gray;position:absolute;visibility:hidden "> welcome
</div>
</body>
</html>
运行时FF错误提示:分析属性“left”值时出错;分析属性“top”值时出错
求教,谢谢
------解决方案--------------------我的也可以
------解决方案--------------------我的版本是1.5.0.7
------解决方案--------------------oDiv.style.left=oEvent.clientX-30 + "px ";
oDiv.style.top=oEvent.clientY+20 + "px ";