高手帮忙呀!popup创建的下拉菜单如何实现离开时自动隐藏
因为用到框架,所以用popup创建的菜单,可是在鼠标滑离popup弹出的窗口时总不能使窗口自动隐藏!我已经在popup弹出的窗口的table标签里加了onmouseout可为什么不是在鼠标滑离的时候关闭,而是在进入到table范围就关闭了!
事例代码如下: '
<html>
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<title> softkeyboard:code by meixx </title>
<script language= "javascript ">
var oPopUp=null;window.createPopup();
function SoftKeyboard(pwdObj){
oPopUp=window.createPopup();
var popBody=oPopUp.document.body;
popBody.style.backgroundColor = "#FFFF99 ";
popBody.style.border = "solid black 1px ";
WriteToPopup(oPopUp,pwdObj);
oPopUp.show(0,22,400,200,pwdObj);
}
function WriteToPopup(oPopUp,pwdObj){
var strHTML= " <html> <head> ";
strHTML+= ' <meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 "> ';
strHTML+= ' <title> test </title> </head> <body style= "margin:0; border:0;overflow:hidden; "> ';
strHTML+= ' <div onMouseOut= "parent.oPopUp.hide(); " > ';
strHTML+= ' <table cellpadding= "0 " cellspacing= "0 " border= "1 " style= "table-layout:fixed;width:100%;height:100%; " ';
strHTML+= ' bordercolor= "red "> <tr> <td> this is a test ! </tr> <tr> <td> this is a test ! </tr> <tr> <td> this is a test ! ';
strHTML+= ' </tr> <tr> <td> this is a test ! </tr> <tr> <td> this is a test ! </tr> <tr> <td> this is a test ! </td> </tr> ';
strHTML+= ' </table> </div> </body> </html> ';
oPopUp.document.write(strHTML);
//alert(strHTML);
}
</script>
</head>
<body>
<input type= "password " id= "txtPwd " name= "txtPwd " onclick= "SoftKeyboard(this) " readonly= "readonly ">
<!-- <div style= "display:none ">
<div style= "display:block; " onMouseOut= "parent.oPopUp.hide(); ">
<table cellpadding= '0 ' height= "200 " width= "200 " cellspacing= '0 ' boder=1 bordercolor= "#FF0000 ">
<tr> <td> this is a test ! </tr>
<tr> <td> this is a test ! </tr>
<tr> <td> this is a test ! </tr>
<tr> <td> this is a test ! </tr>
<tr> <td> this is a test ! </tr>
<tr> <td> this is a test ! </tr>
</table>
</div>
</div>
-->
</body>
</html>
[解决办法]
onMouseOut= "parent.oPopUp.hide(); ">
==>
onmouseover= "parent.oPopUp.hide(); "
[解决办法]
To: badwish(魔心(在职人求职中))
兄弟真是细心呀,多谢提醒!
body 里加上 梅大侠 那句就天衣无缝了,哈,L@@K
<body onmouseover= "if(oPopUp) oPopUp.hide() ">
<input type= "password " id= "txtPwd " name= "txtPwd " onclick= "SoftKeyboard(this) " readonly= "readonly ">
</body>