<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 > } <br> times++;<br> var n = Math.floor(Math.random() * arr.length); // 배열에서 무작위로 선택 <br> var divResult = document.getElementById('divResult');<br> divResult.innerHTML = "< p>귀하께서는 "+ 회 +" 복권 추첨에 당첨되셨습니다. 당첨자는 다음과 같습니다: " + arr[n] +"</p>"<br> } > 이벤트 처리 삭제"/><br> <script type="text/javascript"><br> var sayHi = function () {<br> alert('Hello! ');<br> } }<br><br>var btnDOM2Test = document.getElementById(' btnDOM2Test');</p> btnDOM2Test.addEventListener('click', function () {<p> Alert('클릭했습니다: ' + this.value); <br> }, false);<br><br>btnDOM2Test.addEventListener('click', sayHi, false );<br><br>var btnDelDOM2Test = document.getElementById('btnDelDOM2Test');</p> <p>var del = function () {<br> btnDOM2Test.re moveEventListener('click ', function () { <br> 경고( '클릭했습니다: ' + this. value);<br> , false); </p> btnDelDOM2Test.addEventListener( 'click', del, false);<p></p>//IE9+<p> //btnDOM2Test.attachEvent("onclick", sayHi); </p> // });<p> 휴대폰 번호를 입력하세요 var e = EventUtil . getEvent(); EventUtil.preventDefault(e) ; 용户登录 账号: < ;input type="text" id="txtUID"/> 密码: <br> var txtUID = document.getElementById('txtUID');<br> var txtPWD = document.getElementById('txtPWD');<br> var btnSubmit = document.getElementById('btnSubmit');<br> var frmDemo = document.getElementById ('frmDemo');</p> <p>EventUtil.addHandler(btnSubmit, 'click', function () {<br> alert('我提交了!');<br> if (txtUID.value == "admin") {<br> frmDemo.제출 (); //提交<br> }<br> else {<br> return;<br> }<br> });</p> <p>EventUtil.addHandler(txtUID, 'keydown', function () {<br> var e = EventUtil.getEvent(); //Enter.keyCode = 13;<br> if (e.keyCode == 13) {<br> txtPWD.focus();<br> EventUtil.preventDefault(e);<br> }<br> });<br> < div onclick="this.style.BackgroundColor='red'; event.cancelBubble=true;">div1 div2 div3