javascript脚本不能正常执行
我写了一个jsp页面,前几次都可以正常运行可是这次突然无法正常执行了firefox里的错误控制台报的是document.getElementById("userPassword") has no properties可是我找了半天也没有发现问题!错误是红字处的
谁能帮我看一下
代码如下:
<%@ page language="java" pageEncoding="gb2312"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><bean:message key="index.title" /></title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript">
function validate_form(thisform) {
with(thisform) {
var userId = document.getElementById("userid").value;
var userPassword = document.getElementById("userPassword").value;
if (userId == null || userId == "") {
document.getElementById("userid").style.display = "block";
return false;
}
if (userPassword == null || userPassword == "") {
document.getElementById("passwordError").style.display = "block";
return false;
}
return true;
}
}
</script>
</head>
<body>
<table width="94%" height="459" border="0" cellspacing="0">
<tr>
<td height="43" align="center">
<table width="68%" border="0" cellpadding="0" cellspacing="0"
bgcolor="#CCCCCC">
<tr>
<td height="35" align="center" bgcolor="#0099FF"><bean:message
key="index.head" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10" align="center">
<table width="90%" border="0" cellspacing="0">
<tr>
<td width="77%" height="21"><bean:message key="index.toRegedit" /><html:link
page="/view/reg.jsp">
<bean:message key="index.regedit" />
</html:link></td>
<td width="23%"><html:link page="/admin.jsp">
<bean:message key="index.toAdmin" />
</html:link></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="11" align="center">
<hr>
</td>
</tr>
<tr>
<td align="center" valign="middle"><html:form action="/Log.do"
focus="userid" onsubmit="return validate_form(this)">
<table width="41%" height="132" border="10" cellpadding="10"
cellspacing="0">
<tr bgcolor="#0099FF">
<td colspan="2">
<table width="90%" height="38" border="0" cellspacing="0">
<tr>
<td width="24%" align="center"><bean:message
key="index.userName" /></td>
<td width="76%"><html:text property="userid" size="13"
maxlength="15" />
<div id="userid" style="display:none"><bean:message
key="index.userIdNull" /></div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table width="90%" height="33" border="0" cellspacing="0">
<tr>
<td width="24%" align="center"><bean:message
key="index.password" /></td>
<td width="76%"><html:password property="userPassword" size="13"
maxlength="15" />
<div id="passwordError" style="display:none"><bean:message
key="index.userPassword" /></div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="47%" align="center"><html:submit>
<bean:message key="index.submit" />
</html:submit></td>
<td width="53%" align="center"><html:reset>
<bean:message key="index.reset" />
</html:reset></td>
</tr>
</table>
</html:form> <html:errors /></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
</html>
[此贴子已经被作者于2007-6-30 2:14:06编辑过]