- 论坛徽章:
- 0
|
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 |
|