<%@ page language="java" contentType="text/html; charset=GB18030"
    pageEncoding="GB18030"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>用户登陆</title>
<script language="javascript">
<!--
function loginsubmit()
{
   ID = document.form.ID.value;
   password = document.form.password.value;
   if(ID==""||ID.length>25){
     alert("您的用户忘了填写了或者字符数超过规定长度!");
 document.form.ID.focus();
   }
   else if(password==""||password>20||password<6){
     alert("您的密码忘了填写了或者长度不正确!");
 document.form.password.focus();  
   }
   else {
     document.form.submit();
   }
}
-->
</script>
</head>
<body>&nbsp;&nbsp;&nbsp; <br><br><br>
<form method="post" name="form"><p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 请登陆</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;&nbsp; 用户名 <input type="text" name="ID" size = "23"></p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  密&nbsp; 码 <input type="password" name="password" size = "23">&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;  &nbsp;  
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <input type="button" value="注册" name="register">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <a href = "javascript:loginsubmit();" > <input type="button" value="登录" name="submit"> </a></p>
</form></body>
</html>由于设计的时候用eclispe简单设计了一个窗口登陆的 代码比较乱 关键部分用红色标记了   为啥如果点击了登录按钮javascript没有调用 

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【zhao9302】截止到2008-08-02 01:38:14的历史汇总数据(不包括此帖):
    发帖的总数量:5                        发帖的总分数:90                       每贴平均分数:18                       
    回帖的总数量:5                        得分贴总数量:1                        回帖的得分率:20%                      
    结贴的总数量:5                        结贴的总分数:90                       
    无满意结贴数:0                        无满意结贴分:0                        
    未结的帖子数:0                        未结的总分数:0                        
    结贴的百分比:100.00%               结分的百分比:100.00%                  
    无满意结贴率:0.00  %               无满意结分率:0.00  %                  
    敬礼!

    取消马甲机器人,请点这里:http://www.java2000.net/mycsdn/robotStop.jsp?usern=zhao9302
      

  2.   

    直接<form method="post" name="form" onsubmit = "loginsubmit()">不行么。
      

  3.   

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=GB18030">
    <title>用户登陆 </title>
    <script language="javascript">
    <!--
    function loginsubmit()
    {
      ID = document.form.ID.value;
      password = document.form.password.value;
      if(ID=="" ||brvbarID.length>25){
        alert("您的用户忘了填写了或者字符数超过规定长度!");
    document.form.ID.focus();
      }
      else if(password=="" || brvbarpassword>20 || brvbarpassword <6){
        alert("您的密码忘了填写了或者长度不正确!");
    document.form.password.focus();
      }
      else {
        document.form.submit();
      }
    }
    -->
    </script>
    </head>
    <body>&nbsp;&nbsp;&nbsp; <br> <br> <br>
    <form method="post" name="form"> <p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 请登陆 </p>
    <p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;&nbsp; 用户名 <input type="text" name="ID" size = "23"> </p>
    <p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  密&nbsp; 码 <input type="password" name="password" size = "23">&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp;  &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;  &nbsp;
    <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <input type="button" value="注册" name="register">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <a href = "javascript:loginsubmit();" > aaa </a><input type="button" value="登录" name="submit"> </p>
    </form></body>
    </html>改了一下
    不知道你为什么把按钮放在了<a>之间了,还有你的判断条件
      

  4.   

    <input type="button" value="登录" name="submit" onclick"loginsubmit()">
    改成这样
      

  5.   

    登录按钮改成:<input type="button" value="登录" name="submit" onclick="loginsubmit()"> 
      

  6.   

    把<script language="javascript"> 中间的<!--      -->去掉
      

  7.   

    <input type="button" value="登录" name="submit" onclick="loginsubmit"> 
      

  8.   

    我试了一下,是你的javascript函数里写错了东西,你把
    if(ID=="" ¦ ¦brvbarID.length>25){ 
        alert("您的用户忘了填写了或者字符数超过规定长度!"); 
    document.form.ID.focus(); 
      } 
      else if(password=="" ¦ ¦ brvbarpassword>20 ¦ ¦ brvbarpassword <6){ 
        alert("您的密码忘了填写了或者长度不正确!"); 
    document.form.password.focus(); 
      } 
      else { 
        document.form.submit(); 
      } 这里的判断长度的brvbarID和brvbarpassword不要用,用了就出错。快结贴吧。