Window.Location = "AAA.ASPX"
The above method can only be opened on the current page. If you want to open on the new page, the simplest is to use the following method
form.target = "_ Blank";
form.action = "aaa.aspx";
form.submit();
window.top.location=url can be refreshed and opened in the parent window.
The window.open method is rich in style. For example, we can control the size displayed by the window, the content displayed in the window, and the location, and so on. There is a disadvantage to use Window.open in JS that it is easy to be blocked by the browser. This article introduces various methods to open the new window in JS.
1. Open the full screen of a new window
Copy code 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 the fixed size of the new window
Copy code code as follows:
<ButtonClick = "Window.open ('/Red/', '', 'Width = 800, Height = 300')"> Open1 </Button>
<button Onclight = "varnewwin = window.open ('/red/'); newwin.moveto (50,50); newwin.Resizeto (800,300)"> Open2 </Button>
<butononclight = "window.showmodelessDialog ('/red', '', 'dialogwidth: 800px; dialogheight: 300px')"> Open3 </Button>
3. Open the default size
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_WINMAXIMANEREND
</script>
-------------------------------------------------------------------------------------------------------------------------------------------------------
<scriptlanguage = "javascript">
<!--
Self.moveto (0,0)
Self.Resizeto (Screen.availWidth, Screen.availheight)
//->
</script>
4. Open it normally and open a pop -up window
Copy code code as follows:
<scriptlanguage="JavaScript">
Function Winopen () {
MESG = Open ("CNROSE", "DisplayWindow", "Toolbar = no, Menubar = no, local = no, scrollbars = no");
mesg.document.write (<gead> <Title> Chinese ASP House </Title> </Head> ");
mesg.document.write ("<Enter> 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 code as follows:
<Html xmlns: ie>
<meta http-equiv = "content-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 CSSTTEXT = "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.bordersStyle = 'Inset'}); Background-COLOR: Buttonface; Width: 16px; Height: 14px; FONT-SIZE: 12px; LINE-Height: 11px: 11px ; Cursor: default; ";";
// build window
Include.startdownload (CW_URL, FUNCTION (Source) {Content = Source});
function insert_content () {
var test = "";;
Cw_body.style.overflow = "hidden";
Cw_body.style.backgroundColor = "White";
Cw_body.style.Border = "solid black 1px";
Content = content.replace (/<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 ==' 1 '?' 2 ':': 1 '; Parent.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-heft: 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.0 // NCODE by Windy_SK // N // NSPECIALTHANS for and "STYLE =/" "" "" "" "" +CSSTTEXT+ "FonT-FAMILY: System; Padding-Right: 2px;/">? </span>;
Temp+= "<spanid = min = 'parent.new_cw.hide (); parent.blur ()' style =/"+cstetext+"font-family: webdings;/" title = 'minimum'> 0 </ span>";
Temp += "<spanid = max onClick =/" this.innertext = this.innertext == '1'? '2': '1'; paint.if_max =! Parent.if_max; paint.show_cw () ;/"" STYLE =/"+CSSTTEXT+" FonT-FAMILY: Webdings;/"Title = 'Maximum'> 1 </span>" ";
Temp+= "<span ID = closeonClick = 'Parent.opner = NULL; Parent.close ()' style =/"+CSSttext+"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:"+cwidth+"'" "";
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_max) {
New_cw.show (CW_TOP, CW_LEFT, CW_WIDTH, CW_HEIGHT);
ifof (new_cw.document.ling.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.head);
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_move (e) {
if (draging) {
New_cw.show (e.screen-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.offsetheight == screen.height)
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.offsetheight == screen.height)
Cw_top = e.screen-drag_x;
Cw_left = e.screeny-drag_y;
}
</Script>
</Html>
6, open the full screen
Copy code code as follows:
<html>
<head>
<meta http-equiv = "content-type" content = "text/html; charset = gb2312">
<title>js method to open new window 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 = PARSEFLOT (navigator.appversion.substring (navigator.appversion.indexof ('.')-1, navigator.length)););); navigator.length)));); navigator.length)));
If ((Navigator.appversion.indexof ("Mac")! =-1) && (Navigator.userages.indexof ("msie")! =-1) && (PARSEINT (navigator.appversion))
Window.open (Other, "sub", 'scrollbars = yes');
if (target> = 4) {
if (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-); 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 dialog box
Copy code code as follows:
<script>
window.onload = function () {
varfeatures='status:0;dialogWidth:470px;dialogHeight:470px;dialogTop:100px;dialogLeft:100px;resizable:0;scroll:0;center:1';
showmodelessDialog ("http://www.aspxhome/", window, features);
}
Function Show (LAASN)
{{
var obj;
obj = laysn.style;
obj.visibility = 'visible';
}
Function Hidden (laysn)
{{
var obj;
obj = laysn.style;
obj.visibility = 'Hidden';
}
</script>
8. The child window opens and closes the parent window
Copy code code as follows:
<script>
Window.open ('http://www.aspxhome.com/','width=790, height=590');
Window.opner = null;
window.close ();
</script>