如何创建与IE7,Chrome,Mozilla和Safari兼容的.NET / JavaScript登录页面?

时间:2011-05-23 12:06:46

标签: javascript .net asp.net vb.net

我有一个.NET登录页面。它在Internet Explorer 7中正常运行,但我希望它与Chrome,Mozilla和Safari兼容。

后面的登录代码是:

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()函数。

1 个答案:

答案 0 :(得分:0)

如果你想调试你的javascript,你可以添加“调试器”;对于你的代码,这应该作为浏览器内置调试器的断点(它有一个,Chrome确实如此)。

document.all实际上是你想在这里使用的吗? getElementById或getElementsByName也能正常工作,但在所有浏览器中都支持吗?

相关问题