<br> div{<br> background-color:lightblue;<br> margin:5px;<br> padding:5px;<br><br> }<br> <br> var changeSize = function () {<br> var oTxt = document.getElementById('txt');<br> oTxt.size += 5;<br> }</p> <p>var showMessage = function () {<br> alert('单击事件');<br> alert('事件类型:' + event.type);<br> }</p> <p>window.onload = function () {<br> document.getElementById('btn1').onclick = <br> function () {<br> alert('btn1单击事件');<br> }<br> }<br> 只有三次抽奖机会! <br> var times = 0; //次數<br> var arr = ['一千萬', '女神》, '布加迪威龍' ', '海景別墅', '全英雄全皮膚','無限充值','逢賭必贏'];</p> <p>var btnLottery = document.getElementById('btnLottery');<br> btnLottery. onclick = function () {<br> if(times >= 3)<br> {<br> this.onclick = null;<br> return ;<br> }<br> }<br> }<br> divResult = document.getElementById('divResult ');<br> divResult.innerHTML = "<p>您是第"+ times +"次抽獎,抽中的是:"+ arr[n] +"</p>"## ## }<br> <br> var sayHi = function () {<br> var sayHi = function () {<br> ! ;<br> }</p> <p>var btnDOM2Test = document.getElementById('btnDOM2Test');<br> btnDOM2Test.addEventListener('click', function () {<br> alert('您單擊的是: ' + this.value);<br> }, false);</p> <p>btnDOM2Test.addEventListener('click', sayHi, false);</p> <p>var btnDelDOM2Test = document.getElementBy(ftn );</p> <p>var del = function () {<br> btnDOM2Test.removeEventListener('click', function () { <br> 喜歡 this ', function () { <br> ## }, false);<br> }, false);<br> btnDOM2Test.removeEventListener('click', sayHi, false);<br> List click', del, false);</p> <p>/ /IE9+<br> //btnDOM2Test.attachEvent("onclick", sayHi);<br> //bDOM2Test.attach ;<br> //});<br> 請輸入手機號碼 & type< "text" id="txtPhoneNum"/> <br> var txtPhoneNum = document.getElementBy('PhaddoneNum');txtPhoneNum = document.getElementById('PhaddoneNum');txtPhoneNum = document.getElementBy>('PhaddoneNum');txtPhoneNum document. 'keypress', function () {<br> var e = EventUtil.getEvent();<br> //alert( if (e.keyCode < 48 || e.keyCode > 57) {<br> EventUtil.preventDefault(e);<br> </p> <p><form id="frmDemo" action="submitPage.htm"><br> <h3>使用者登入</h3><br> <label for="=" xuid>帳號:## <label for="=" uid>帳號:## txt< ; label><br> <input type="text" id="txtUID"><br /><br> <label for="PWD">密碼:</label> “密碼”id=“txtPWD”/><br /><br> <br> <br></label></label></label></p> <p><br><br><br><br></p> <p><br><br><br><br><br><br><br><br></p> <p><br><br><br><br><br><br><br></p> <p><br><br><br><br><br><br><br></p>##################################################################################################################### #<script type="text/javascript">### var txtUID = document.getElementById('txtUID');### var txtPWD = document.getElementByyd(' getElementById('btnSubmit');### var frmDemo = document.getElementById('frmDemo');######EventUtil.addHandler(btnSubmit, 'click', function () {### frmDemo.submit() ; // 提交### }## # else {### ######EventUtil.addHandler(txtUID, 'keydown', function () {## # var e = EventUtil.getEvent(); //Enter.keyCode = 13;### if (e.keyCode == 13) {### ### }### }); ### ######<div onclick="this.style.backgroundColor='red'; event.cancelBubble=true;">div1### <div onclick="this .style.backgroundColor ='blue';">div2### <div onclick="this.style.backgroundColor='black';">div3### </div>##1 div 1 >###</身體>###</html>###</div> </div>