JavaScript 開啟視窗控制方法
JavaScript 開啟視窗控制方法
Java Script 開啟視窗控制方法
開啟視窗控制方法
JavaScrip範例Response.Write(" <script> parent.document.location= 'index.aspx' </script> ")
Response.End()
完整的寫法Response.Write(" <script language=javascript>")
Response.Write(" parent.location.href='/index.aspx';")
Response.Write(" <script>")
Response.End()
開啟新視窗的寫法// 簡易開始
Respose.Write("<script language='javascript'>window.open('test.asp');</script>");
// 控制開啟
Respose.Write("<script language='javascript'>window.open('test.asp','','resizable=1,scrollbars=0,status=1,menubar=no,toolbar=no,location=no, menu=no');</script>");
各種開啟方法的差異1.Response.Redirect("XXX.aspx",true)——直接轉向新的頁面,原視窗被代替;
2.Response.Write("<script>window.open('XXX.aspx','_blank')</script>")——原視窗保留,另外新增一個新頁面;
3.Response.Write("<script>window.location='XXX.aspx'</script>")——打開新的頁面,原視窗被代替;
4.Server.Transfer("XXX.aspx")——打開新的頁面;
5.Response.Write("<script>window.showModelessDialog('XXX.aspx')</script>")——原視窗保留,以對話方塊形式打開新視窗;
6.Response.Write("<script>window.showModelDialog('XXX.aspx')</script>")——對話方塊形式打開新視窗,原視窗被代替;
Java Script 開啟視窗控制方法
開啟視窗控制方法
JavaScrip範例Response.Write(" <script> parent.document.location= 'index.aspx' </script> ")
Response.End()
完整的寫法Response.Write(" <script language=javascript>")
Response.Write(" parent.location.href='/index.aspx';")
Response.Write(" <script>")
Response.End()
開啟新視窗的寫法// 簡易開始
Respose.Write("<script language='javascript'>window.open('test.asp');</script>");
// 控制開啟
Respose.Write("<script language='javascript'>window.open('test.asp','','resizable=1,scrollbars=0,status=1,menubar=no,toolbar=no,location=no, menu=no');</script>");
各種開啟方法的差異1.Response.Redirect("XXX.aspx",true)——直接轉向新的頁面,原視窗被代替;
2.Response.Write("<script>window.open('XXX.aspx','_blank')</script>")——原視窗保留,另外新增一個新頁面;
3.Response.Write("<script>window.location='XXX.aspx'</script>")——打開新的頁面,原視窗被代替;
4.Server.Transfer("XXX.aspx")——打開新的頁面;
5.Response.Write("<script>window.showModelessDialog('XXX.aspx')</script>")——原視窗保留,以對話方塊形式打開新視窗;
6.Response.Write("<script>window.showModelDialog('XXX.aspx')</script>")——對話方塊形式打開新視窗,原視窗被代替;
留言
張貼留言