Ferris教程学习笔记:js示例2.5 记住密码提示框

 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml"><head>
 3 <meta http-equiv="Content-Type" content="text/html; charset=gbk">
 4 <title>记住密码提示框</title>
 5 <style type="text/css">
 6   body,input,p{margin:0;padding:0;}
 7   body{font:12px/1.5 Tahoma;}
 8   #outer{width:200px;margin:10px auto;}
 9   input{margin-right:5px;vertical-align:middle;}
10   #tips{padding:5px;margin-top:5px;background:#ffefa4;border:1px solid #f90;display:none;}
11 </style>
12 </head>
13 <body>
14 <div id="outer">
15   <label><input type="checkbox" />两周内自动登陆</label>
16   <div style="display:none;" id="tips">为了您的信息安全,请不要在网吧或公用电脑上使用此功能!</div>
17 </div>
18 <script type="text/javascript">
19  window.onload = function(){
20    var input = document.getElementsByTagName("label")[0];
21    var div = document.getElementsByTagName("div")[1];
22    input.onmouseover = function(){
23      div.style.display = "block";
24    };
25    input.onmouseout = function(){
26      div.style.display = "none";
27    
28    };
29  };
30 </script>
31 </body>
32 </html>
原文地址:https://www.cnblogs.com/kaka100/p/3469718.html