JavaScript滑鼠經過事件(onmouseover)

滑鼠經過事件,當滑鼠移到一個物件上時,該物件就會觸發onmouseover事件,並執行onmouseover事件呼叫的程式。

實例:當滑鼠移到綁定了onmouseover事件的元素時,彈出對話框

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>php.cn</title>
        <script>
            function fun(){
                window.alert("请确认四周没有人再点击提交")
            } 
        </script>
    </head>
    <body>
        <form>
            机密:
            <input name="txt" type="text" >
            <input name="" type="button" value="提交" onmouseover="fun()"/>
        </form>
    </body>
</html>


#
繼續學習
||
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>php.cn</title> <script> function fun(){ window.alert("请确认四周没有人再点击提交") } </script> </head> <body> <form> 机密: <input name="txt" type="text" > <input name="" type="button" value="提交" onmouseover="fun()"/> </form> </body> </html>