6-3 鼠标经过事件(onmouseover)
本节编程练习不计算学习进度,请电脑登录imooc.com操作

鼠标经过事件(onmouseover)

鼠标经过事件,当鼠标移到一个对象上时,该对象就触发onmouseover事件,并执行onmouseover事件调用的程序。

现实鼠标经过"确定"按钮时,触发onmouseover事件,调用函数info(),弹出消息框,代码如下:

运行结果:

 

任务

补充右边编辑器第13行,当鼠标经过"确定"按钮后,调用message()函数,弹出消息对话框。

  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title> 鼠标经过事件 </title>
  6. <script type="text/javascript">
  7. function message(){
  8. confirm("请输入密码后,再单击确定!"); }
  9. </script>
  10. </head>
  11. <body>
  12. <form>
  13. 密码:<input name="password" type="password" >
  14. <input name="确定" type="button" value="确定"/>
  15. </form>
  16. </body>
  17. </html>
下一节