最近在做一個jsp登錄頁面的時候,碰到了一個問題。
<%@ page language="java" contentType="text/html" pageEncoding="utf-8"%>
<html>
<head>
<title>管理員登錄頁面</title>
<script type="text/javascript">
function chkData()
{
if(frmLogin.uername.value=="")
{
alert("請輸入用戶名。");
return false;
}
else if(frmLogin.userpassword.value=="")
{
alert("請輸入密碼。");
return false;
}
else
{
return true;
}
}
</script>
</head>
<body>
<center>管理員登錄</center>
<form name="frmLogin" action="chkadminlogin.jsp" method="post">
<table align="center" border="1">
<tr>
<td>用戶名:</td>
<td><input type="text" name="username"/></td>
</tr>
<tr>
<td>密 碼:</td>
<td><input type="password" name="userpassword"/></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="登錄" onClick="return chkData();"/>
<input type="reset" value="重置"/>
</td>
</tr>
</table>
</form>
</body>
</html>
當編寫好了後在myeclipse 10.0中總是提示紅色部分錯誤,檢查沒有半點錯誤,到最後原來是因為版本的問題,myeclipse 10.0 的版本很高,但是不穩定,不支持js腳本的return.這可能是個bug吧 沒辦法了,只好下了個8.6版本。記住了 版本越高越不穩定。
本文出自 “趙玉強的博客” 博客,請務必保留此出處http://zhaoyuqiang.blog.51cto.com/6328846/1105345