2010-11-12 63 views
0

我有以下網頁在IE中失真,但驗證,我找不到任何問題...... Here's a link to the page在FF,Safari瀏覽器,鉻,但在IE8中是不正確的。在iE8奇怪的網頁問題...可能javascript

我在Chrome中也遇到這個錯誤:「Uncaught TypeError:無法調用null(匿名函數)onload方法'焦點'。

任何建議將是巨大的 - 的代碼,如下所示和所使用的包含文件出現在其他的網頁,從而導致沒有問題可言:

<!--#include virtual="/System/Startup_FranchiseClient.asp"--> 
<% 
EnsurePageIsHTTPS 

Dim blnShowResults : blnShowResults = False 
Dim SQLCommand 
Dim objConn 
Dim rsUser 
Dim rsEmail 
Dim strTempPassword 
Set objConn = Server.CreateObject("ADODB.Connection") 
Set rsUser = Server.CreateObject("ADODB.RecordSet") 
Set rsEmail = Server.CreateObject("ADODB.RecordSet") 
Dim strPassword_Encrypted 
Dim objEncrypt : Set objEncrypt = New Encrypt_MD5 

If Request.Form("ForgotPassword") = "1" then 
    SQLCommand = "SELECT * FROM Clients WHERE EmailAddress = '" & CleanSQLText(Request.Form("strUsername")) & "'" 
    objConn.Open strConn 
    rsUser.Open SQLCommand, objConn, adOpenKeySet, adLockOptimistic 
    if rsUser.RecordCount <> 1 then 
     strSecurity_LoginError = "Sorry, your details could not be found. Please check your email address and try again.<br>" 
    Else 
     strTempPassword = NewGUID() 
     strTempPassword = Mid(strTempPassword, 2, 8) 
     strPassword_Encrypted = objEncrypt.EncryptMD5(strTempPassword) 
     rsUser("ResetPasswordOnNextLogin") = True 
     rsUser("Password") = strPassword_Encrypted 
     rsUser.Update 
     blnShowResults = True 
     SQLCommand = "SELECT '" & CleanSQLText(strTempPassword) & "' AS NewPassword, EmailAddress FROM uvw_EmailContent_ForgotPassword WHERE EmailAddress = '" & CleanSQLText(Request.Form("strUsername")) & "'" 
     rsEmail.Open SQLCommand, objConn, adOpenStatic, adLockReadOnly 
     SendPublicFranchiseEmailTemplate GetSiteConfig("Public_AutoEmailsFrom"), rsEmail("EmailAddress"), "Inside Guides Password Assistance", "EmailTemplate_ForgotPassword", True, rsEmail 
     blnShowResults = True 
    End if 
    rsUser.Close 
    Set rsUser = Nothing 
End if 
%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
<title>Inside-Guides.co.uk - Advertiser Admin</title> 
<!--#include virtual="/Assets/Templates/Public/Franchise/HeadCSS.asp"--> 
</head> 
<body class="advertisers" onload="javascript:document.getElementById('strUsername').focus();"> 
<!--#include virtual="/Assets/Templates/Public/Franchise/TemplateStartPages.asp"--> 
<h1>Forgot Password</h1> 
<% 
If blnShowResults = False then 
    %> 
    <div class="bg MainCopy"> 
    <p>Please enter your email address below and we will email you your password:</p><br /> 
    <p class="ErrorText"><% = strSecurity_LoginError %></p> 
    <form name="LoginForm" method="post" action="ForgotPassword.asp"> 
     <input type="hidden" name="ForgotPassword" value="1" /> 
     <table> 
      <tr> 
       <th align="left" valign="middle" style="width:110px;"> 
        Email Address: 
       </th> 
       <td align="left" valign="middle"> 
        <input type="text" name="strUsername" value="" /> 
       </td> 
       <td align="right" valign="middle"> 
        <input type="submit" class="submit" value="Send Password" /> 
       </td> 
       </tr> 
      </table> 
    </form> 
</div> 
    <% 
Else 
    %> 
    <% 
    If Session("Role_Developer_DebugUser") = True then 
     %> 
     <h1><font color="red"><% = strTempPassword %></font></h1> 
     <% 
    End if 
    %> 
    <span class="MainCopy">A new password has been emailed to you. Please check your email and use the temporary password provided to access your account<br /> via the link provided. &nbsp; You can then choose a new password.</span> 
    <% 
End if 
%> 

<!--#include virtual="/Assets/Templates/Public/Franchise/TemplateEnd.asp"--> 
</body> 
</html> 
<!--#include virtual="/System/Shutdown.asp"--> 
+0

顯示客戶端問題的服務器端代碼是無用的。顯示瀏覽器看到的生成的客戶端代碼。 – epascarello 2010-11-12 20:46:48

+0

您應該停止通過連接字符串並使用參數來停止創建SQL命令。不管CleanSQLText方法有多聰明,都有可能是一個等待被利用的安全漏洞。 – 2010-11-12 20:52:30

回答

2

你說得對,它的的JavaScript。你沒有一個ID爲strUsername的元素。將id =「strUsername」添加到要聚焦的輸入元素。

<input type="text" id="strUsername" name="strUsername" value="" /> 
+0

非常感謝回覆,幫助很大......我應該在這裏放置id =「strUsername」:? – sue 2010-11-12 20:51:48

+0

對不起,發送了一下!請原諒我的基本幫助要求......是否應將id添加到name =「strUsername」的輸入元素中?非常感謝您的幫助 – sue 2010-11-12 20:53:27

+0

它應該被添加到任何您想要關注的輸入字段中!但我假設是,是的。我編輯了我的回覆以顯示此... – Jeff 2010-11-12 20:55:34

0
document.getElementById('strUsername').focus(); 

此調用失敗,因爲你沒有與頁面上ID的元素。您需要分配的ID屬性和名稱屬性:

<input type="text" id="strUsername" name="strUsername" value="" /> 

就像錯誤消息告訴你,它找不到由ID的元素,使函數返回空值,並且可以在空引用上不要調用focus()

+0

非常感謝您的幫助,我已經完成了刪除Chrome jscript錯誤的操作,但頁面仍然在IE中被扭曲......只是無法弄清楚它。感謝您修復,但如果有任何其他想法的變形將不勝感激...... – sue 2010-11-12 20:59:56

+0

不知道你的意思是「扭曲」。我可以看到你的頂級菜單最後一項運行到下一行。看起來像這是由於您的菜單鏈接中的標籤定義的寬度。 – jaywon 2010-11-12 21:08:48