2011-05-23 31 views
0

我有一个.NET登录页面。它可以在Internet Explorer 7中正常工作,但我希望使其与Chrome,Mozilla和Safari兼容。如何制作与IE7,Chrome,Mozilla和Safari兼容的.NET/JavaScript登录页面?

登录后面的代码是:

Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click 

{.................. 

ScriptManager.RegisterStartupScript(Me, Me.GetType(), "test", "login()", True) 

........} 

aspx页面代码:

function login() 

{ 

    if(document.getElementById("ctl00_Sidebar_Contentplaceholder_Lo1_SaveFlag").value =="Y") 

    { 
     window.open("Home.aspx?PlotRef=" + document.all("ctl00_Sidebar_Contentplaceholder_Lo1_SaveFlag").value + "&print=print","",'location=no,fullscreen=no,menubar=no,titlebar=yes,status=yes,toolbar=no,scrollbars=yes,resizable=yes');  

     if(document.getElementById("ctl00_Sidebar_Contentplaceholder_Lo1_hidChangePass").value =="Y") 
     { 
      window.open("ChangePass.aspx","ChangePassword","top=50,left=50,height=310,width=725,location=no,menubar=no,status=yes,addressbar=no,toolbar=no,scrollbars=no,fullscreen=no,resizable=no") 
     } 

     window.open('','_self',''); 
     window.close();  
    } 
} 

这是行不通的。我试图调试它,但在调试模式下,光标只能遍历后面的代码。我无法在aspx页面输入javascript login()函数。

+0

我不确定你在问什么。你问如何在这些浏览器中调试JavaScript或想知道你的JavaScript的问题?我们可能需要更多的代码才能做出正确的诊断。 – alnorth29 2011-05-28 15:48:59

+0

你的答案是[这里是在stackoverflow.com](http://stackoverflow.com/q/2095966/774448) – KKI 2011-05-28 15:49:38

回答

0

如果你想调试你的JavaScript,那么你可以添加“调试器”;到您的代码,这应该作为浏览器的内置调试器(它有一个Chrome浏览器)的断点。

是document.all其实你想在这里使用? getElementById或getElementsByName是否可以正常工作,但是在所有浏览器中都支持?