js open a new window a lot of ways, this article roughly sorted out some, need friends can refer to the following
window.location= "aaa.aspx" The above method can only be opened on the current page, if you want to open the new page, the simplest way is to use the following methods form.target= "_blank"; form.action= "aaa.aspx"; form.submit (); Window.top.location=url the page in the IFRAME can be refreshed on the parent window The window.open method can be controlled in a variety of styles, such as we can control the size of the window display, the contents of the window display, and location, and so on. Is the use of JS Window.Open has a disadvantage is easy to be blocked by the browser. This article describes the various ways to open a new window in JS. 1, open new window full screen code as follows: <html><head> <title>blue</title> < script> function ow (owurl) { var tmp=window.open ("About:blank", "" "," Fullscreen=1 ") Tmp.moveto ( 0,0); Tmp.resizeto (screen.width+20,screen.height); tmp.focus (); tmp.location=owurl; } </SCRIPT> </head> <body> <ahref= "Javascript:ow" (' http://www.aspxhome.com/'); " > blog</a> 2, open new window fixed size Copy code code as follows: <buttononclick= "window.open" ('/red/', ', ', ' width =800,height=300 ') ">open1</button> <button onclick=" Varnewwin=windOw.open ('/red/'); Newwin.moveto (50,50); Newwin.resizeto (800,300) ">open2</button> <buttononclick = "Window.showmodelessdialog ('/red ', ', ', ' dialogwidth:800px;dialogheight:300px ')" >open3</button> 3, default size open Copy code code as follows: <script> //tmtc_winmaximizer if (document.layers) { var larg= screen.availwidth-10; var altez=screen.availheight-20;} else{ var larg=screen.availwidth-2; var altez=screen.availheight;} Self.resizeto (Larg,altez); Self.moveto (0,0); //tmtc_winmaximizerend </script> -------------------------------------------- <scriptlanguage= "JavaScript" > <!-- Self.moveto (0,0) Self.resizeto (screen.availwidth,screen.availheight) //--> </script > 4, normal open open a pop-up window code as follows: <scriptlanguage= "JavaScript" > function Winopen () { Mesg=open ("Cnrose", "Displaywindow", "Toolbar=no,,menubaR=no,location=no,scrollbars=no "); mesg.document.write (" <HEAD><TITLE> China ASP Home </TITLE>< /head> "); mesg.document.write (" <CENTER>http://www.aspxhome</CENTER> "); } </ script> <form> <input type= "button" Name= "Button1" value= "Cn-bruce" onclick= "Winopen ()" > </form> ------------------------------------------------------------------------------- --------------- <a href= #onclick =window.open (' http://www.aspxhome ', ' target ', ' param ') >a</a > 5,chromeless window for IE6 sp1 copy code as follows: <html xmlns:ie> <meta http-equiv= "Conten T-type "content=" text/html;charset=gb2312 "> <ie:download id=" include "style=" Behavior:url (#default # Download) "/> <title>ChromelessWindow</title> <scriptlanguage=" JScript > var cw_width = 400; var cw_height = 300; var cw_top = 100; var CW_left = 100; var cw_url = "http://www.cnbruce.com/bluebook/"; var NEW_CW = Window.createpopup (); var CW _body = new_cw.document.body; var content = "; var csstext =" Margin:1px;color:black; Border:2pxoutset;border-style:expression_r (Onmouseout=onmouseup=function () {this.style.borderstyle= ' outset '}, Onmousedown=function () {if (event.button!=2) this.style.borderstyle= ' inset '}); background-color:buttonface;width : 16px;height:14px;font-size:12px;line-height:11px;cursor:default; "; //build window include.startdownload (cw_url,function (source) {Content=source}); function insert_content () { var temp = ""; CW_Body.style.overflow = "hidden"; cw_ Body.style.backgroundColor = "White"; CW_Body.style.border = "solid black 1px"; content = Content.replace (/& Lt;a ([^>]*) >/g, "<aonclick= ' Parent.open (THIS.HREF); return false ' $1>"); temp = "<table width= 100% height=100% cellpadding=0cellspacing=0 border=0> "; TEMP = "<trstyle=" Font-size:12px;background: #0099CC; Height:20;cursor:default ' ondblclick= ' Max.innertext =max.innertext== ' 1 '? ' 2 ': ' 1 ';p ARENT.IF_MAX=!PARENT.IF_MAX;PARENT.SHOW_CW (); onmouseup = ' parent.drag_up (event) ' Onmousemove= ' Parent.drag_move (event) ' onmousedown= ' Parent.drag_down (event) ' Onselectstart= ' return false ' oncontextmenu= ' return false ' > '; temp + = ' <tdstyle= ' color: #ffffff; padding-left:5px ' >chromelesswindow for IE6 sp1</td>; temp = <tdstyle= ' color: #ffffff; padding-right:5px; ' Align=right> "; temp + + <span id=help onclick=" alert (' Chromelesswindow for IE6 sp1-ver 1.0nnCode by Windy_sk Nnspecialthanks for Andot ') "style=" "+csstext+" FONT-FAMILY:SYSTEM;PADDING-RIGHT:2PX; " >?</span> "; temp =" <spanid=min onclick= ' parent. New_cw.hide ();p Arent.blur () ' style= ' "+csstext+" font-family:webdings; Title= ' Minimum ' >0</span> '; temp = <spanid=max onclick= ' this.innertext=this.innertext== ' 1 '? 2 ': ' 1 ';p arent.iF_max=!parent.if_max;parent.show _CW (); " Style= "" +csstext+ "font-family:webdings;" Title= ' Maximum ' >1</span> '; temp = ' <span id=closeonclick= ' parent.opener=null;parent.close () ' Style= "" +csstext+ "FONT-FAMILY:SYSTEM;PADDING-RIGHT:2PX;" Title= ' Close ' >x</span> "; temp + +" </td></tr><tr><tdcolspan=2> "; temp + = "<div id=includestyle= ' Overflow:scroll;overflow-x:hidden;overflow-y:auto"; height:100%; Width: "+cw_width+" ' > "; temp = content; Temp + =" </div> "; temp + +" </td></tr> </table> "; cw_body.innerhtml = temp; } settimeout (" Insert_content () ", 1000); var If_max = true; function show_cw () { Window.moveto (10000, 10000); if (If_max) { New_ Cw.show (Cw_top, Cw_left, Cw_width, Cw_height); if (typeof (New_CW.document.all.include)!= "undefined") { New_CW.document.all.include.style.width = cw_width; New_CW.document.all.Max.innerText = "1"; } }else{ new_cw.show (0, 0, screen.width, screen.height); New_ CW.document.all.include.style.width = screen.width; } } Window.onfocus = show_cw; Window.onresize = show_cw; /move window var drag_x,drag_y,draging=false function Drag_m Ove (e) { if (draging) { new_cw.show (e.screenx-drag_x, e.screeny-drag_y, cw_width,cw_height); return false; } } function Drag_down (e) { if (e.button==2) return; if (new_ Cw.document.body.offsetwidth==screen.width&&new_cw.document.body. Offsetheight==screen.height) return; drag_x=e.clientx; drag_y=e.clienty; draging=true; E.srcelement.setcapture (); } function drag_up (e) { draging=false; E.srcelement.releasecapture (); if (new_cw.document.body.offsetwidth==screen.width&&new_ CW.document.body. offsetheight==screen.height) return; cw_top = e.screenx-drag_x; cw_left = e.screeny-drag_y; } </SCRIPT> </HTML> & nbsp 6, Open is full screen code as follows: <html> <head> <meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "> <title>js Open new Window Method code collection-China ASP home-http://www.aspxhome</title> <link href= "Index.css" rel= "stylesheet" type= "Text/css" > <script language= "JavaScript" type= "Text/javascript" > <!-- function machakfull (ie,other) { x=screen.availwidth; y=screen.availheight; Target =parsefloat (navigator.appVersion.substring navigator.appVersion.indexOf ('. ') -1,navigator.appversion.length); if (navigator.appVersion.indexOf ("Mac")!=-1) && ( Navigator.userAgent.indexOf ("MSIE")!=-1) && (parseint (navigator.appversion) ==4)) window.open (Other, "Sub", ' Scrollbars=yes '); if (target >= 4) { if (navigator.appname== "Netscape") { varmachakfull= window.open (Other, "Machakfull ", ' scrollbars=yes ', ' width= ' +x+ ', height= ' +y+ ', top=0,left=0 '); Machakfull.moveto (0,0); Machakfull.resizeto (x,y);} if (navigator.appname== "Microsoft Internet Explorer") window.open (Ie, "Machakfull", "Fullscreen=yes"); } Else window.open (Other, "Sub", ' Scrollbars=yes '); } function Mm_gotourl () {//v3.0 var i, args=mm_gotourl.arguments; Document. Mm_returnvalue =false; for (i=0; i< (args.length-1); i+=2) Eval_r (args[i]+ ". location=" "+args[i+1]+" "); } //--> </script> </head> <body bgcolor= "#3366CC" scroll= Noonload= "Machakfull" ('/bbs/', ') ' > ------------------------------------------------------------- --------------------------------- <script> window.open ('/', ', ' fullscreen=1 '); Window.close (); </script> 7, Web Page dialog code as follows: <script> window.onload=function () { varfeatures= ' status:0;d ialogwidth:470px;dialogheight:470px;dialogtop:100px;dialogleft:100px;resizable:0;scroll:0;center:1 '; showModelessDialog ("http://www.aspxhome/", window,features); } function Show (LAYSN) { var obj ; obj=laysn.style; obj.visibility= ' visible '; } function hidden (laysn) { var obj;& nbsp obj=laysn.style; obj.visibility= ' hidden '; } </script> 8, the child window opens, closes the parent window code as follows: <script> window.open (' http://www.aspxhome.com/', ', ', ' width=790,height=590 '); window.opener=null ; window.close (); </script>