日期:2014-05-20  浏览次数:20711 次

为什么这段javascript怎么不好用
<%@   page   contentType= "text/html;   charset=EUC-KR "   %>
<%@   taglib   prefix= "s "   uri= "/struts-tags "   %>
<%@taglib   uri= "/WEB-INF/tld/app.tld "   prefix= "app "   %>
<html>
<head>
<s:head   theme= 'simple '/>
<link   rel= 'stylesheet '   href= ' <%=   request.getContextPath()   %> /css/style.css '>
<script   type= " "   language= "JavaScript ">
        function   checkdata()
        {
              toDate=document.viewTelephoneCheckList.toDate.value;
              fromDate=document.documentviewTelephoneCheckList.fromDate.value;
              telChecker=document.viewTelephoneCheckList.telChecker.value;

if(toDate.length==0   ||   fromDate.length==0   ||   telChecker.length==0   )
{
                alert( "error ");
                return   false;
}
        }
</script>
</head>
<body>
<s:form   name= 'viewTelephoneCheckList '   action= 'viewTelephoneCheckList '   theme= 'simple '   onsubmit= "return   checkdata() ">
<table   cellpadding= '3 '   cellspacing= '0 '   border= '1 '   align= "center ">
<tr>
<td   width= '100 '   align= "center "> 痢八   老磊 </td>
<td   width= '300 '   > <s:datetimepicker   name= 'toDate '   displayFormat= 'yyyy-MM-dd '   /> &nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp; <s:datetimepicker   name= 'fromDate '   displayFormat= 'yyyy-MM-dd '   /> </td>
<td   width= '100 '   align= "center "> 痢八磊 </td>
<td   width= '300 '> <s:textfield   name= 'telChecker '   /> </td>
</tr>
<tr>
<td   width= '100 '   align= "center "> 矫档 </td>
<td   width= '300 '> </td>
<td   width= '100 '   align= "center "> 矫焙备 </td>
<td   width= '300 '> <s:select   name= 'sigunguCodeId '   list= 'sigunguSelectList '   listKey= 'sigunguCodeId '   listValue= 'name '/> </td>
</tr>
</table>
<div   align= "right "> <s:submit   value= "炼雀 "> </s:submit> &nbsp;&nbsp;&nbsp; </div>
</s:form>

为什么点饥后不去检验这段javascript脚本有没有什么错误啊

------解决方案--------------------
这个名字(documentviewTelephoneCheckList)找不到,有关提交验证,只要验证脚本中有问题,报出错误,默认为提交,而不是验证失败,不提交,看不到错误的原因,提交后已经转向其它页面.
------解决方案--------------------
查看 <s:datetimepicker name= 'toDate ' displayFormat= 'yyyy-MM-dd ' /> &nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp; <s:datetimepicker name= 'fromDate ' displayFormat= 'yyyy-MM-dd ' />
这个控件