<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到底如何用了,对话框都弹出来了,为什么还提交了出去

解决方案 »

  1.   

    return isValid() --> return isValid();
    试试看
      

  2.   

    可能存在IE缓存,试下下面的设置:Internat --> 选项 --> 常规 --> 设置 --> 每次访问网页时(检查)
      

  3.   

    打开网页后你看下源文件是不是和预期的一样,不一样的话,按4楼的做,一样的话使用其他浏览器试试,还不行的话,看看网页是不是有特殊的声明,如果没有特别的声明还不行的,换在button上面onclick吧,不值得为一件事花那么多时间