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>


Weiter lernen
||
<!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>
einreichenCode zurücksetzen