codefans

导航

<2006年5月>
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

统计

常用链接

留言簿(2)

随笔分类

随笔档案

文章分类

文章档案

程序设计链接

搜索

最新评论

阅读排行榜

评论排行榜

一些javascript脚本

只能输入汉字
<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("你没有刷新就关闭了?");


控制Iframe页面的前进与后退
window.frames["frameName"].history.back();
window.frames["frameName"].history.forward();

posted on 2006-02-25 11:12 春雷的博客 阅读(298) 评论(1)  编辑  收藏

评论

# re: 一些javascript脚本 2006-05-26 14:02 ererr

erre  回复  更多评论   


只有注册用户登录后才能发表评论。


网站导航: