<script type="text/javascript">
function isValid()
{
phone=document.forms[0].phone.value;
var a=phone.match(/^13[456789]\d{8}$/);
if(a==null || handset.substring(0,4)== "1349 ")
{
alert( "handset is not valid. ");
return false;
}
return true;
}
</script>
<html:form action="/test" onsubmit="return isValid()">
phone : <html:text property="phone"/><br/>
username : <html:text property="username"/><br/>
<html:submit"/><html:cancel/>
</html:form>
javascript到底如何用了,对话框都弹出来了,为什么还提交了出去
function isValid()
{
phone=document.forms[0].phone.value;
var a=phone.match(/^13[456789]\d{8}$/);
if(a==null || handset.substring(0,4)== "1349 ")
{
alert( "handset is not valid. ");
return false;
}
return true;
}
</script>
<html:form action="/test" onsubmit="return isValid()">
phone : <html:text property="phone"/><br/>
username : <html:text property="username"/><br/>
<html:submit"/><html:cancel/>
</html:form>
javascript到底如何用了,对话框都弹出来了,为什么还提交了出去
解决方案 »
- java的web项目spring线程socket序列化问题,求高手帮忙
- 继承和引用,变量定义位置问题
- Exception occurred during event dispatching 数据库操作异常 不知怎么解决
- 怎样取Object里面的值??
- 帮忙写个正则表达式,很简单
- java开发网站用一套什么工具(学生做,不需要太复杂,也不要过简单。)
- 为什么-Integer.MIN_VALUE还是等与Integer.MIN_VALUE呢???
- 为什么类中声明为protected的构造函数不能被调用?
- snoopy学Java之JB8
- 简单问题:如何是主进程停止运行若干长时间?
- 怎么把scanf("%d %d %d",&x,&y,&z)翻译成java语言的?
- 多合一软件关盘如何制作
试试看