225.复制粘贴 <BODY> <input type="file" name='a1'><input type="button" value='复制粘贴' onclick="haha()"><div id="aa"></div> <SCRIPT LANGUAGE="JavaScript"> <!-- function haha() { clipboardData.setData("Text",a1.value); aa.innerText=clipboardData.getData("Text"); } //--> </SCRIPT> </BODY>//
226.获得对象类型 switch (object.constructor){ case Date: ... case Number: ... case String: ... case MyObject: ... default: ... }// 227.图片加载失败时重新加载图片 <img src="http://www.mbsky.com/infoview/aa.gif" onerror="this.src='http://www.mbsky.com/infoview/aa.gif'">// 228. //font_effect.htc <PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="glowit()" /> <PUBLIC:ATTACH EVENT="onmouseout" ONEVENT="noglow()" /> <SCRIPT LANGUAGE="JScript"> //定义一个保存字体颜色的变量 var color; function glowit() { color=element.style.backgroundColor; element.style.backgroundColor='white' } function noglow() { element.style.backgroundColor=color } </SCRIPT>
//abc.css tr{behavior:url(font_effect.htc);} 229.可以通过css和htc改变表格的颜色,仅IE支持 //xxx.html <link rel="stylesheet" type="text/css" href="abc.css"> <TABLE border='1' id="a1"> <TR style="background-color:red"> <TD>1</TD> <TD>2</TD> <TD>3</TD> </TR> <TR style="background-color:yellow"> <TD>4</TD> <TD>5</TD> <TD>6</TD> </TR> </TABLE>// 230.在页面上画点 function a(x,y,color) { document.write("<img border='0' style='position: absolute; left: "+(x+20)+"; top: "+(y+20)+";background-color: "+color+"' width=1 height=1>") }// 231.自动关闭网页 <script LANGUAGE="javascript"> <!-- setTimeout('window.close();', 10000); //60秒后关闭 // --> </script> <p align="center">本页10秒后自动关闭,请注意刷新页面</p>
|