JS事件 鼠標移開事件(onmouseout)鼠標移開事件,當鼠標移開當前對象時,執行onmouseout調用的程序。


鼠標移開事件(onmouseout)

鼠標移開事件,當鼠標移開當前對象時,執行onmouseout調用的程序。

當把鼠標移動到"登錄"按鈕上,然后再移開時,觸發onmouseout事件,調用函數message(),代碼如下:

運行結果:

 

任務

補充右邊編輯器第12行,當鼠標移開"點擊我"的按鈕時,調用message()函數,彈出消息對話框。


<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>鼠標移開事件 </title>
<script type="text/javascript">
  function message(){
    alert("不要移開,點擊后進行MK網!"); }
</script>
</head>
<body>
<form>
  <a href="http://www.imooc.com" onmouseout="message()">點擊我</a>
</form>
</body>
</html>





免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM