標籤:over title var htm this focus button 執行 alert
<!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使用表