<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page contentType="text/html; charset=gb2312"%>
<%@ page import="com.dawnpro.login.Login"%>
<%
String ERROR_LOGIN_INVALIDATION = "登录失败,请检查用户名口令是否正确.若为服务站用户,请再确认与公司的协议有效性.";
String ERROR_TIMEOUT = "您还未登陆该系统或者用户的有效性已过期,请重新登陆.";String error = null;
request.setCharacterEncoding("gb2312");
String action = request.getParameter("operation");
if(null != action && action.equals("login"))
{
  com.zebra.person.User user = Login.login(request,false);
  if(null != user && user.getUserType().equals(user.USER_TYPE_INTERNAL_ORG))
response.sendRedirect("mainframe.html");
  else if(null != user && user.getUserType().equals(user.USER_TYPE_EXTERNAL))
   response.sendRedirect("portal/sws/mainframe.html");
else
   error = ERROR_LOGIN_INVALIDATION;
}String errortype = request.getParameter("errortype");
if(null != errortype && errortype.equals("timeout"))
  error = ERROR_TIMEOUT;
%>
<html>
<head>
<title> 登录CRM管理系统 </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<link rel="stylesheet" type="text/css" href="skins/blue/style.css">
<script language="JavaScript" src="js/FireWindow.js"></script>
<script language="JavaScript" src="js/Validate.js"></script>
<script language="JavaScript">
<!--
function submittomcat()
{
   document.form2.username.value=document.form1.username.value;
   document.form2.password.value=document.form1.password.value;
   document.form2.submit();
}
//-->
</script>
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
.style3 {color: #FFFFFF; font-weight: bold; }
-->
</style>
</head><body bgcolor="0060AA" valign="middle">
<form action="login.jsp" name="form1" onsubmit="submittomcat()">
<input type="hidden" name="operation" value="login"/>
<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td><table border="0" width="535" cellspacing="0" cellpadding="0" align="center" valign="middle">
      <tr>
        <td width="372" height="69"><img src="images/login1.gif" width="372" height="111"></td>
        <td width="163"><p><img src="images/login3.gif" width="163" height="111"></p></td>
      </tr>
      <tr>
        <td height="167"><img src="images/login2.gif" width="372" height="167"></td>
        <td height="167" background="images/login5.gif"><table width="90%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="30" colspan="2"><span class="style3">CRM系统</span></td>
            </tr>
            <tr>
              <td width="27%" height="30"><span class="style1">帐号:</span></td>
              <td width="73%" height="30"><input type="text" name="username" style="width:100px;border:#706D66 1px solid;"></td>
            </tr>
            <tr>
              <td height="30"><span class="style1">密码:</span></td>
              <td height="30"><input type="password" name="password" style="width:100px;border:#706D66 1px solid;"></td>
            </tr>
            <tr align="center">
              <td height="40" colspan="2">
                <input name="imageField" type="image" src="images/login_submit.gif" width="53" height="19" border="0">
&nbsp;<img src="images/login_reset.gif" width="53" height="19"></td>
            </tr>
        </table></td>
      </tr>
      <tr>
        <td height="45" colspan="2"  background="images/login4.gif"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td width="86%" style="padding-left:10px;font-family: arial,helvetica;font-size:11px;">Copyright 2004 DongFeng Cummins Engine CO.,LTD</td>
              <td width="2%">&nbsp;</td>
              <td width="12%" style="padding-right:10px"><img src="images/dceclogo.gif" width="60" height="25"></td>
            </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
<script language="JavaScript"> var size;
var resolution;
if ((screen.width == 640) && (screen.height == 480))
{
size = "640 x 480";
resolution = 640;
}else if ((screen.width == 800) && (screen.height == 600))
{
size = "800 x 600";
resolution = 800;
}else if ((screen.width == 1024) && (screen.height == 768))
{
size = "1024 x 768";
resolution = 1024;
}else
{
size = "other";
resolution = 1152;
}
if(resolution < 1024)
{
document.write("<font color=\"#FFFFFF\">经系统检测,你的屏幕分辨率为 " + size + ",为了获得最佳效果,本系统要求使用1024 x 768分辨率.</font>");
}
</script>
</form>
<form action="logintomcat.jsp" name="form2">
  <input type="hidden" name="username"/>
  <input type="hidden" name="password"/>
</form>
</body>
<%if(null != error){%>
<script language="JavaScript">
alert('<%=error%>');
</script>
<%}%>
</html>
问题:   点击这两个图标怎么会提交  ::: <tr align="center">
              <td height="40" colspan="2">
                <input name="imageField" type="image" src="images/login_submit.gif" width="53" height="19" border="0">
&nbsp;<img src="images/login_reset.gif" width="53" height="19"></td>
            </tr>

解决方案 »

  1.   

    当提交的时候
    onsubmit = true 提交  否则不提交
      

  2.   

    当用户点击提交按钮(即type=submit 或者 type=image的时候)会调用此方法,但你在JS中调用form1.submit不会调用此方法 另外,你的代码不太好,onsubmit的方法最好有返回true false的值,true表示此Form可以提交,False表示不提交。在你的代码中似乎应该是返回false,否则会将你代码中的form2.submit覆盖掉。
      

  3.   

    如果你是想提交form2而不是form1,应该修改代码为
    onsubmit="submittomcat();return false" 以禁止form1的提交
      

  4.   

    楼上说的极是,在般onsubmit="f()"是在提交之前进行校验的函数,
    通常是要通过form里边的submit button来激活