目标:实现页面加载的时候弹出提示框,点击确定后跳转到指定页面。我的方法:
一个空白的页面。
C#后台如下代码:    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("<script type=\"text/javascript\">alert(\"fdfdf\");location(\"default.aspx\")</script>");
    }
存在问题:
alert事件可以实现,但是无法实现location事件。请高手赐教!

解决方案 »

  1.   

    Response.Write("<script type=\"text/javascript\">alert(\"fdfdf\");window.location=\"default.aspx\";</script>");
      

  2.   


    Response.Write("<script type=\"text/javascript\">alert(\"fdfdf\");location.href=(\"default.aspx\")</script>");
      

  3.   

    window.location.href=''
    也可以在js中写fucntion gotopage()
    {
     window.location.href=''
    }
    然后在CS代码中注册脚本事件page.registerStart...
      

  4.   

    感谢楼上各位。location.href测试成功。 想问下,location和location.href有什么区别呢。 如果以上代码写在button_click里为什么能正常运行呢。 楼下解答吧。
      

  5.   

    location指向的是window对象下面的Location对象。。需要跳转还是写上href属性的比较好