From:51JS,JS牛人的作品

只能输入汉字
<input onkeyup="value=value.replace(/[^\u4E00-\u9FA5]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\u4E00-\u9FA5]/g,''))">


只能输入全角
<input onkeyup="value=value.replace(/[^\uFF00-\uFFFF]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\uFF00-\uFFFF]/g,''))">

只能输入数字
<input onkeyup="value=value.replace(/[^\d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">

只能输入英文和数字
<input onkeyup="value=value.replace(/[\W]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">

关闭父窗口(无提示)
<script>
opener="";
window.open().document.write("<input value='关闭父窗口' type='button' onclick='opener.window.close()'>");
</script>

让表格半透明
<body bgcolor="red">
This is body!
<div style="position:absolute;background:black;filter:Alpha(Opacity=50);color:white;height:300;top:0;left:0">This is layer!</div>
</body>

<body style="filter:Alpha(Opacity=50)">
<iframe width="100%" height="100%" src="http://sina.com.cn">


<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
<input name=Button onClick=document.all.WebBrowser.ExecWB(1,1) type=button value=打开>
<input name=Button onClick=document.all.WebBrowser.ExecWB(2,1) type=button value=关闭所有>
<input name=Button onClick=document.all.WebBrowser.ExecWB(4,1) type=button value=另存为>
<input name=Button onClick=document.all.WebBrowser.ExecWB(6,1) type=button value=打印>
<input name=Button onClick=document.all.WebBrowser.ExecWB(6,6) type=button value=直接打印>
<input name=Button onClick=document.all.WebBrowser.ExecWB(8,1) type=button value=页面设置>
<input name=Button onClick=document.all.WebBrowser.ExecWB(10,1) type=button value=属性>
<input name=Button onClick=document.all.WebBrowser.ExecWB(17,1) type=button value=全选>
<input name=Button onClick=document.all.WebBrowser.ExecWB(22,1) type=button value=刷新>
<input name=Button onClick=document.all.WebBrowser.ExecWB(45,1) type=button value=关闭>

屏蔽 JS 错误
function killErrors() { return true; }
window.onerror = killErrors; dd

只在关闭窗口的时候提示,刷新的时候不提示
if(event.clientX>document.body.clientWidth)alert("你没有刷新就关闭了?");




http://www.51js.com/viewthread.php?tid=1059&fpage=2&highlight=&page=2

posted @ 2005-09-08 15:23  Elaine Shi  阅读(488)  评论(0编辑  收藏  举报