[Web]JS網頁事件篇
<body onLoad="alert('歡贏')" onUnload="alert('謝謝')">
<input type="button" onClick="alert('單擊')"><input type="button" onDbClick="alert('雙擊')">
function getButton(){ switch(event.button) { case 0 : alert("左鍵");break; case 1 : alert("右鍵");break; case 2 : alert("中鍵");break; }}document.onmousedown = getButton; //監聽器
<body onmousedown="alert('點擊')">
<body onContextMenu="alert('NO') ; return false" >
<marquee direction="up" onMouseOver="this.stop()"onMosueOut="this.start()">
function getMouse(){ event.x; event.y;}document.onmousemove = getMouse;
<img src="img1" onMouseOver = " this.src = ' img2 ' " onMouseOut = " this.src = ' img1 ' " >
picID.style.visibility = 'visible'picID.style.visibility = 'hidden'
function getkeyCode(){ asc = event.keyCode; key = String.fromCharCode(asc);}document.onkeydown = getkeyCode; // 可以取得所有按鍵,但無法分辨大小寫document.onkeypress = getkeyCode; //可分辨大小寫
window.loaction.href = "www.google.com";
asc = event.keyCode;key = String.fromCharCode(asc);str += key;txt.innerHTML = str;document.onkeypress = showkey;
<div onMouseOver = "this.style.cursor='hand'">手形指標</div>
靜態指標:this.style.cursor='url(img.cur)'動態指標:this.style.cursor='url(img.ani)'
看網頁原始碼就破解
var password = prompt("請輸入密碼","");
陣列 = document.all.tags("A");
沒有留言:
張貼留言