myeclipse10.0不支持onClick的return chkData()
最近在做一个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