1、事件 body 事件 onload onunload onbeforeunload 常見事件 onclick(單擊)、ondblclick(雙擊)、onkeydown(按鍵按下)、onkeyPRess(點擊按鍵)、onkeyup(按鍵釋放)、onmousedown(鼠標按下)、onmousemove(鼠標移動)、onmouSEOut(鼠標離開元素范圍)、onmouseover(鼠標移動到元素范圍)、onmouseup(鼠標按鍵釋放
2、動態設置事件 類似于net中注冊事件 document.ondbclick = f1; //讓document.ondbclick的事件處理函數為f1 3、window對象 window.document.body 當前瀏覽器窗口 方法 alert() confirm("確定?") navigate("http://www.baidu.com"); var timerId = setInterval("alert('hello')",500); clearInterval(timerId) setTimeout() clearTimeout() showModalDialog("window.htm") 模態窗體 showModelessDialog("window.htm")非模態窗體 屬性 window.location.href window.location.reload() 刷新頁面 window.event altKey ctrlKey shiftKey returnValue 取消后續內容的執行 srcElement 引發事件的事件源 keyCode 引發事件時的鍵值 button 引發事件時的鼠標鍵1為左鍵,2為右鍵,3為左右鍵同時 screen 分辨率 width height clipboardData 粘貼板 getData("Text") setData("Text",val) clearData("Text") history back() go(-1) forward() go(1) document 方法 write() writeln() getElementById() getElementsByName() getElementsByTagName() createElement() appendChild() 4、獲取元素內容 value innerText innerHTML 5、動態修改元素樣式 this.style.backgroundColor this.style.fontSize this.style.marginTop this.style.display = "none"隱藏 ""顯示 this.style.width = "18px"
6、form對象 事件 onsubmit 方法 submit()
新聞熱點
疑難解答