日期:2014-05-16 浏览次数:20480 次
<script> function test() { if(document.a.b.value.length>50) { 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>
<input onkeyup="value="/oblog/value.replace(/[^\u4E00-\u9FA5]/g,'')">
<script language=javascript> function onlyEng() { if(!(event.keyCode>=65&&event.keyCode<=90)) event.returnvalue=false; } </script> <input onkeydown="onlyEng();">
<script language=javascript> function onlyNum() { if(!((event.keyCode>=48&&event.keyCode<=57)||(event.keyCode>=96&&event.keyCode<=105))) //考虑小键盘上的数字键 event.returnvalue=false; } </script> <input onkeydown="onlyNum();">
<input onkeyup="value="/oblog/value.replace(/[\W]/g,"'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">6. 验证油箱格式
<SCRIPT LANGUAGE=javascript RUNAT=Server> function isEmail(strEmail) { if (strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) return true; else alert("oh"); } </SCRIPT> <input type=text onblur=isEmail(this.value)>
<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>
<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>
<script language="javascript"> <!-- function CheckForm() { if (document.form.name.value.length == 0) { alert("请输入您姓名!"); document.form.name.focus(); return false; } return true; } --> </script>
<script language="javascript"> <!-- function CheckForm() if (document.form.PWD.value != document.form.PWD_Again.value) { alert("您两次输入的密码不一样!请重新输入."); document.ADDUser.PWD.focus(); return false; } return true; } --> </script>