日期:2014-05-16 浏览次数:20607 次
<Script> function checkPassword(testObject) { if (testObject.value.length < 6) { alert("密码长度不得小于6"); testObject.focus(); testObject.select(); } } </Script> 请输入密码: <INPUT TYPE="text" onBlur="checkPassword(this)">
<Script> if (confirm("你满十八岁了吗?")) location = "adult.htm"; else alert("等你成年以後再来吧!"); </Script>
<Script> var bgColor = prompt("你喜欢哪一种底色:\n浅蓝色请按1,粉红色请按2",1) if (bgColor == 1) document.bgColor = "#CCFFFF"; else if (bgColor == 2) document.bgColor = "#FFCCFF"; else document.bgColor = "#FFFFFF"; </Script>
<Script> with (document) { write ("您的屏幕显示设定值如下:<P>"); write ("屏幕的实际高度为", screen.availHeight, "<BR>"); write ("屏幕的实际宽度为", screen.availWidth, "<BR>"); write ("屏幕的色盘深度为", screen.colorDepth, "<BR>"); write ("屏幕区域的高度为", screen.height, "<BR>"); write ("屏幕区域的宽度为", screen.width); } </Script>
<Script> if ( screen.width < 800 || screen.colorDepth < 8 ){ var msg = "本网站最佳浏览模式为 800 * 600 * 256"; alert(msg); } </Script>
<Script> function getEvent(evnt) { eventWin = open ('','','width=200,height=100'); with (eventWin.document) { write("事件类型:", event.type); write("<br>鼠标的x坐标:", event.screenX); write("<br>鼠标的y坐标:", event.screenY); } } document.write ("单击...") document.onmousedown = getEvent; </Script>
<Script> function getCoordinate(evnt) { if (document.all) { x = event.screenX; y = event.screenY; } else { x = evnt.screenX; y = evnt.screenY; } status = "水平坐标:"+ x + ";垂直坐标:"+ y; } document.onmousemove = getCoordinate; </Script>
<Script> function whichKey(evnt) { if (document.all) { x = event.button; if( x==1 ) alert("你单击了左键"); if( x==2 ) alert("你单击了右键"); } else { x = evnt.button; if( x==1 ) alert("你单击了左键"); if( x==3 ) alert("你单击了右键"); return false; } } document.onmousedown = whichKey; document.write("请单击鼠标左/右键"); </Script>