1. 程式人生 > >JAVAscript學習筆記 js事件 第一節 (原創) 參考js使用表

JAVAscript學習筆記 js事件 第一節 (原創) 參考js使用表

onchange onf form 看不見 鼠標 hello cnblogs html 加載

<!DOCTYPE html>
<html lang="en" onUnload="ud()">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function demo() {
            alert("hello");
        }

        function onOver(ooj) {
            ooj.innerHTML = "鼠標移入顯示";
        }

        
function onOut(ooj) { ooj.innerHTML = "鼠標移出顯示"; } function changeDemo(bg) { alert("內容改變了啊") } function changeDemo1(bg) { bg.style.background = "red"; } function changeDemo2(bg) { bg.style.background = "
blue"; } function mgs() { alert("內容加載完畢") } function bu(bg) { var b = bg.value; alert("鼠標移開事件(您輸入的是)" + b); } function ud() { alert("您關閉了網頁") } </script> <style> .div
{ width: 100px; height: 100px; background-color: cadetblue; } </style> </head> <body onload="mgs()" onunload="ud()"> <!--網頁加載完畢事件,網頁關閉事件(關閉後執行看不見)--> <button onclick="demo()">按鈕</button> <!--單機事件--> <div class="div" onmouseout="onOut(this)" onmouseover="onOver(this)">開始顯示</div> <form> <input type="text" onchange="changeDemo(this)"/> <!--文本內容改變事件--> <input type="text" onselect="changeDemo1(this)" onfocus="changeDemo2(this)"/> <!--文本內容選中事件--> <!--鼠標聚集(選中)事件--> <input type="text" onblur="bu(this)"/> <!--移開光標事件事件--> </form> </body> </html>

JAVAscript學習筆記 js事件 第一節 (原創) 參考js使用表