免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2774 | 回复: 0
打印 上一主题 下一主题

JS长度限制+屏蔽关键字+两次输入密码是否相同+屏蔽右键+复制文本到剪帖板+载入页面 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-08-13 11:10 |只看该作者 |倒序浏览
1. 长度限制
script>
function test()
{
if(document.a.b.value.length>5)
{
alert("不能超过50个字符!");
document.a.b.focus();
return false;
}
}
/script>
form name=a onsubmit="return test()">
textarea name="b" cols="40" wrap="VIRTUAL" rows="6">/textarea>
input type="submit" name="Submit" value="check">
/form>
2. 屏蔽关键字(这里屏蔽***和****)
script language="javascript1.2">
function test() {
if((a.b.value.indexOf ("***") == 0)||(a.b.value.indexOf ("****") == 0)){
alert(":)");
a.b.focus();
return false;}
}
/script>
form name=a onsubmit="return test()">
input type=text name=b>
input type="submit" name="Submit" value="check">
/form>
3. 两次输入密码是否相同
FORM METHOD=POST ACTION="">
input type="password" id="input1">
input type="password" id="input2">
input type="button" value="test" onclick="check()">
/FORM>
script>
function check()
{
with(document.all){
if(input1.value!=input2.value)
{
alert("false")
input1.value = "";
input2.value = "";
}
else document.forms[0].submit();
}
}
/script>
4.屏蔽右键
body oncontextmenu="return false" ondragstart="return false" onselectstart="return false">
加在body中
/body>
5.复制文本到剪帖板
input title="点击复制标题和地址到剪贴版,直接在POPO/MSN上粘贴即可." type=button value="点击复制本网址,发给POPO/QQ/MSN好友共享" name="B3" onclick="copyToClipBoard()">
script language='javascript'>
function copyToClipBoard(){
var clipBoardContent='';
clipBoardContent+=document.title;
clipBoardContent+=window.location;
window.clipboardData.setData("Text",clipBoardContent);
alert("你已复制链接及标题,请粘贴到POPO/MSN等发给好友!");
}
/script>
6.载入页面
title>载入页面/title>
meta http-equiv="Content-Type" content="text/html; charset=gb2312">
style type="text/css">
!--
.unnamed1 { background-color: #000000}
-->
/style>
/head>
body>
table border=0 cellpadding=0 cellspacing=0 width="100%" height="100%">
tr>
form name=loading>
      td align=center>
        p align="center"> /p>
        p align="center">font color="#00FF00" size="2">/font>/p>
        p>
          input type=text name=chart size=46 style="font-family:Arial; font-weight:bolder;
color:#00FF00; background-color:black; padding:0px; border-style:none;">
          br>
          br>
          input type=text name=percent size=46 style="font-family:Arial; color:#00FF00;
text-align:center; border-width:medium; border-style:none;" class="unnamed1">
          br>
          br>
          font color="#00FF00" size="2" >
          script>
var bar = 0
var line = "||"
var amount ="||"
count()
function count(){
bar= bar+2
amount =amount + line
document.loading.chart.value=amount
document.loading.percent.value=bar+"%"
if (bar99)
{
setTimeout("count()",100);
}
else
{
alert("载入完毕")
window.location = "http://flea.shangdu.com";
}
}
/script>
/font>/p>
         /td>
/form>
/tr>
/table>
/body>
/html>


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/75961/showart_1129600.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP