本帖最后由 抽烟男孩 于 2013-5-6 16:00 编辑
大神!改后不管输入什么都是第一次输入的结果!!!求解- <html>
- <head>
- <base href="<%=basePath%>">
-
- <title>My JSP 'MyJsp.jsp' starting page</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()
- {
- var userName = document.getElementsByName("score");
- if(userName.length<4 && userName.length>2){
- alert("rigth");
- }
- else{
- alert("error");
- }
- }
- </script>
- </head>
-
- <body>
- <form action="index.jsp" method="post">
- <input type="text" name="score" /><button onclick="validate()">提交</button>
- </form>
- </body>
- </html>
复制代码 |