我有一个经典的asp页面,它正在开发IE和Safari,但不是在firefox或chrome中。看看这个网址
我的Asp页面代码是
<HTML>
<HEAD>
<TITLE>USER LOGIN</TITLE>
<script language="JavaScript">
<!--
function SetFocus() {
var field = document.forms("Form1").item("txtUserID");
field.select();
field.focus();
}
//-->
</script>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<style>
.v8Blue{ font-family:Verdana; font-size:8pt; color:#1E3B51;}
</style>
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<table width="75%" border="0" align="center">
<tr>
<td height="80"> </td>
</tr>
<tr>
<td align="center">
<%
' Check if User has previously rejected by the Server for invalid Log On
If Session("RequestLogOnSuccess_Delphi") = "NO" then
Response.Write "<table width='100%' border='0' cellspacing='0' cellpadding='0'>"
Response.Write "<tr>"
Response.Write "<td align='center'><font face='Arial, Verdana, Times New Roman' size='2' color='#CC0000'>YOUR LOG ON IS INVALID. PLEASE TRY AGAIN.</font></td>"
Response.Write "</tr>"
Response.Write "</table>"
else
Response.Write "<p> </p>"
End if
%>
</td>
</tr>
</table>
<form method="post" action="../Request_WebProcess/Request_LogOn_Process.asp" name="Form1">
<table width=23% border=0 cellpadding=0 cellspacing=0 align="center" height="119">
<tr>
<td colspan=7> <img src="images/login_01.jpg" width=370 height=58 alt=""></td>
</tr>
<tr>
<td width="35" rowspan=4> <img src="images/login_03.jpg" width=35 height=83 alt=""></td>
<td colspan=2>
<div align="center">
<input name="txtUserID" type="text" class="v8blue" id="username" size="15">
</div>
</td>
<td width="12" rowspan=2> <img src="images/login_05.jpg" width=12 height=27 alt=""></td>
<td colspan=2>
<div align="center">
<input name="txtPassword" type="password" class="v8blue" id="password" size="15">
</div>
</td>
<td width="64" rowspan=4> <img src="images/login_07.jpg" width=54 height=83 alt=""></td>
</tr>
<tr>
<td colspan=2> <img src="images/login_08.jpg" width=133 height=4 alt=""></td>
<td colspan=2> <img src="images/login_09.jpg" width=136 height=4 alt=""></td>
</tr>
<tr>
<td width="100" rowspan=2> <img src="images/login_10.jpg" width=100 height=56 alt=""></td>
<td colspan=3> <a href="#"><img src="images/login_11.jpg" name="Image19" width="82" height="30" border="0" onClick="document.forms('Form1').submit()"></a></td>
<td width="99" rowspan=2> <img src="images/login_12.jpg" width=99 height=55 alt=""></td>
</tr>
<tr>
<td colspan=3 height="21"> <img src="images/login_13.jpg" width=82 height=26 alt=""></td>
</tr>
<tr>
<td colspan=7 height="2"> <img src="images/login_14.jpg" width=370 height=20 alt=""></td>
</tr>
<tr>
<td colspan=7> </td>
</tr>
<tr>
<td width="35"> <img src="images/spacer.gif" width=35 height=1 alt=""></td>
<td width="100"> <img src="images/spacer.gif" width=100 height=1 alt=""></td>
<td width="33"> <img src="images/spacer.gif" width=33 height=1 alt=""></td>
<td width="12"> <img src="images/spacer.gif" width=12 height=1 alt=""></td>
<td width="38"> <img src="images/spacer.gif" width=37 height=1 alt=""></td>
<td width="99"> <img src="images/spacer.gif" width=99 height=1 alt=""></td>
<td width="64"> <img src="images/spacer.gif" width=54 height=1 alt=""></td>
</tr>
</table>
<table width="70%" border="0" align="center">
<tr align="center">
<td width="51%" height="12"> </td>
<td width="49%" height="12"> </td>
</tr>
<tr align="center">
<td colspan="2"><img src="../Delphi_Logo.gif" width="397" height="77"></td>
</tr>
<tr align="center">
<td colspan="2"><font face="Arial, Helvetica, sans-serif" size="4"><font face="Georgia, Times New Roman, Times, serif"><font face="Arial, Helvetica, sans-serif" size="4"><font face="Georgia, Times New Roman, Times, serif"><font color="#CC9933" size="5"><font size="4" color="#000000" face="Arial, Helvetica, sans-serif">SINGAPORE
INTERNET PURCHASE</font></font></font></font></font></font></td>
</tr>
</table>
<table width="63%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr align="center">
<td><font face="Arial, Helvetica, sans-serif" size="4"><i><font face="Arial, Helvetica, sans-serif" color="#993333" size="2">(Please
log in your user name and password ) </font><font face="Georgia, Times New Roman, Times, serif" color="#993333"></font></i></font></td>
</tr>
<tr align="center">
<td> </td>
</tr>
<tr align="center">
<td><font face="Arial, Helvetica, sans-serif" size="2"><a href="ForgetPassword.asp">CLICK
HERE IF YOU FORGET YOUR PASSWORD</a></font></td>
</tr>
<tr align="center">
<td> </td>
</tr>
<tr align="center">
<td> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="97">
<tr>
<td height="70"> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</form>
</BODY>
</HTML>
答案 0 :(得分:1)
您是否检查过浏览器的控制台?这是Chrome报告的错误:
Uncaught TypeError: Property 'forms' of object #<HTMLDocument> is not a function
更改此行:
var field = document.forms("Form1").item("txtUserID");
是:
var field = document.forms["Form1"]["txtUserID"];
// or
var field = document.forms.Form1.txtUserID;
或者我可能会这样做:
var field = document.getElementById("username");
答案 1 :(得分:0)
我有解决方案
更改
<td colspan=3> <a href="#"><img src="images/login_11.jpg" name="Image19" width="82" height="30" border="0" onClick="document.forms('Form1').submit()"></a></td>
要
<td colspan=3> <a href="#"><img src="images/login_11.jpg" name="Image19" width="82" height="30" border="0" onClick="document.forms[0].submit()"></a></td>