<SCRIPT LANGUAGE="JavaScript">
<!--
function check(s){
if(!s.match(/^EM0\d{2}$/)){
alert("输入的内容不正确");
return false;
}
return true;
}//-->
</SCRIPT><form name="form1" method="post" onSubmit="return check(this.txt.value)">
<input type="text" name="txt">
<input type="submit" value="提交看看">
</form>
<!--
function check(s){
if(!s.match(/^EM0\d{2}$/)){
alert("输入的内容不正确");
return false;
}
return true;
}//-->
</SCRIPT><form name="form1" method="post" onSubmit="return check(this.txt.value)">
<input type="text" name="txt">
<input type="submit" value="提交看看">
</form>
解决方案 »
- 回答了一个为什么类要用prototype,涉及实例化对象的过程和深拷贝,浅拷贝等基础知识,在这分享下,菜鸟看看,欢迎指正
- jquery重写实现confirm功能
- js问题请教
- 小白急求帮助 !!
- 这句怎样写?
- 网页打印,取部分打印的问题。
- aspTemplate 的JScript版本,模拟PHPLIB的Template,并请教两个问题 (回复给分)
- 如何让光标在敲回车时跳到下一个Text框
- 在页面上有多个checkbox,name有一定规律,如何写一个函数,使其中的一部分都为checked?
- 我想提交表到另一个帧,同时本帧也刷新,如何实现
- 为什么层不能打印出来???????????????????????
- 请问如何取得元素的父对象?急用,在线等
if(/^EV0[0-9][1-9]$/g.test(str))
alert("yes");
else
alert("no");
<!--
function chk(oValue) {
alert(oValue);
if(oValue!="") {
var re=/^EV0((0\d)|(\d{2}))$/;
if(re.test(oValue)) {
alert("还行,算输入正确!");
} else {
alert("没有输入正确的格式哦!~");
}
}
}
//-->
</Script>
<input type="text" id="stefli" name="stefli" value="EV0">
<input type="button" value="检查" onClick="chk(document.all.stefli.value)">