Window.location = "aaa.aspx"
La méthode ci-dessus ne peut être ouverte que sur la page actuelle.
form.target = "_ blanc";
form.action = "aaa.aspx";
form.submit ();
window.top.location = URL peut être rafraîchi et ouvert dans la fenêtre parent.
La méthode Window.Open est riche en style. Il y a un inconvénient d'utiliser Window.Open en JS qu'il est facile d'être bloqué par le navigateur. Cet article présente diverses méthodes pour ouvrir la nouvelle fenêtre dans JS.
1. Ouvrez le plein écran d'une nouvelle fenêtre
Copier le code du code comme suit:
<html> <adref>
<Title> Blue </Title>
<cript>
Fonction ow (owurl) {
var tmp = window.open ("À propos: blanc", "", "complet = 1")
tmp.moveto (0,0);
Tmp.resizeto (screp.width + 20, screp.height);
tmp.focus ();
tmp.location = owurl;
}
</cript>
</ head>
<body>
<ahref = "javascript: ow ('http://www.aspxhome.com/');">
blog </a>
2. Ouvrez la taille fixe de la nouvelle fenêtre
Copier le code du code comme suit:
<buttonClick = "Window.Open ('/ Red /', '', 'width = 800, height = 300')"> Open1 </futton>
<Button onclight = "Varnewwin = window.open ('/ red /'); newwin.moveto (50,50); newwin.resizeto (800,300)"> Open2 </ / Button>
<UnOnClight = "Window.ShowModelessDialog ('/ Red', '', 'DialogWidth: 800px; DialogHeight: 300px')"> Open3 </futton>
3. Ouvrez la taille par défaut
Copier le code du code comme suit:
<cript>
// tmtc_winmaximizer
if (document.layers) {
var larg = écran.AvailWidth-10;
var altez = écran.availight-20;}
autre {
var larg = écran.AvailWidth-2;
var altez = écran.availight;}
Self.Resizeto (Larg, Alnez);
Self.moveto (0,0);
// TMTC_WINMAXIMANEREND
</cript>
-------------------------------------------------- -------------------------------------------------- -------------------------------------------------- -
<criptLanguage = "JavaScript">
<! -
Self.moveto (0,0)
Self.resizeto (screen.availwidth, écran.availight)
// ->
</cript>
4. Ouvrez-le normalement et ouvrez une fenêtre pop -up
Copier le code du code comme suit:
<criptLanguage = "JavaScript">
Fonction winopen () {
Mesg = open ("cnrose", "displaywindow", "toolbar = no, menuBar = no, local = no, scrollbars = no");
Mesg.Document.Write (<evead> <Title> Chinese ASP House </Title> </Ead> ");
Mesg.Document.Write ("<Entrée> http: //www.aspxhome </ Center>");
}
</cript>
<Formulaire
<input type = "Button" name = "Button1" value = "cn-buce" onclick = "winopen ()">
</ form>
------------------------------------------------ - - -------------------------------------------------- -------------------------------------------------- -------------------------------------------------
<A href = # onclick = window.open ('http: //www.aspxhome', 'cible', 'param')> a </a>
5. Fenêtre sans chromation pour IE6 SP1
Copier le code du code comme suit:
<Html xmlns: ie>
<meta http-equiv = "content-type" content = "text / html; charset = gb2312">
<Ie: télécharger id = "include" style = "comportement: url (# par défaut # téléchargement)" /> />
<Title> ChromlessWindow </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; couleur: noir; bordure: 2pxoutset; border-style: expression_r (onMouseout = onMouseUp = function () {this.style.borderstyle = 'setset'}, onMoudown = function () {if (event .Button! ";";
// Construire une fenêtre
Include.startDownload (cw_url, fonction (source) {content = source});
fonction insert_content () {
var test = "" ;;
Cw_body.style.overflow = "Hidden";
Cw_body.style.backgroundcolor = "blanc";
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 + = "<trrstyle = '; Font-Size: 12px; Background: # 0099cc; Height: 20; Cursor: Default'ondblclick = /" Max.innerText ==' 1 '?' 2 ':': 1 '; Parent.if_max =! Return false'oncontextMenu = 'return false'> "";
Temp + = "<tdstyle = 'couleur: #ffffff; padding-heft: 5px'> chromlesswindow pour ie6 sp1 </td>" ";
Temp + = "<tdstyle = 'couleur: #ffffff; padding-droite: 5px;' Align = droite>" ;;
Temp + = "<span id = help onclick = /" alert ('chromlesswindow pour ie6 sp1 -ver 1.0 // ncode by windy_sk // n // nspecialthans for et "style = /" "" "" "" + CsstText + "Font-Family: System; Padding-droite: 2px; /">?
Temp + = "<spandid = min = 'parent.new_cw.hide (); parent.blur ()' style = /" + cstetext + "font-family: webdings; /" title = 'minimum'> 0 </span> " ;
Temp + = "Spanid = max onclick =" this.innertex = this.innertext == '1'? "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 = includeyle = 'overflow: scroll; overflow-x: Hidden; overflow-y: auto; hauteur: 100%; largeur:" + cwidth + "'" "";
temp + = contenu;
temp + = "</div>";
temp + = "</td> </tr> </ table>" ";
Cw_body.innerhtml = temp;
}
setTimeout ("insert_content ()", 1000);
var if_max = true;
fonction 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)!
New_cw.document.all.include.style.width = cw_width;
New_cw.document.all.max.innertext = "1";
}
} Autre {
New_cw.show (0, 0, screp.width, screp.head);
New_cw.document.all.include.style.width = screen.width;
}
}
window.onfocus = show_cw;
window.onresize = show_cw;
// Déplacer la fenêtre
var drag_x, drag_y, daging = false
Fonction drag_move (e) {
if (dragage) {
New_cw.show (e.screen-drag_x, e.screeny-drag_y, cw_width, cw_height);
Retourne false;
}
}
Fonction drag_down (e) {
if (e.button == 2) retour;
if (new_cw.document.body.offsetwidth == écran.width && new_cw.document.offsetheight == screen.height)
drag_x = e.clientx;
drag_y = e.clienty;
dague = true;
e.srcelement.setCapture ();
}
fonction drag_up (e) {
dague = false;
e.srcelement.releascapture ();
if (new_cw.document.body.offsetwidth == écran.width && new_cw.document.offsetheight == screen.height)
Cw_top = e.screen-drag_x;
Cw_left = e.screeny-drag_y;
}
</cript>
</html>
6, ouvrez le plein écran
Copier le code du code comme suit:
<html>
<adal>
<meta http-equiv = "content-type" content = "text / html; charset = gb2312">
<Title> Méthode JS pour ouvrir la nouvelle collection de code de fenêtre - Chine ASP Home - http: //www.aspxhome </taptin>
<link href = "index.css" rel = "Stylesheet" type = "text / css">
<script lingots = "javascript" type = "text / javascript">
<! -
Fonction machakfull (c'est-à-dire autre) {
x = écran.AvailWidth;
y = écran.AvailHeight;
Target = parseflot (Navigator.Appversion.SubString (Navigator.Appversion.Indexof ('.') - 1, Navigator.Length));););
If ((Navigator.Appversion.Indexof ("Mac")! = -1) && (Navigator.Userries.Indexof ("MSIE")! = -1) && (ParseInt (Navigator.Appversion))
Window.open (autre, "sub", 'scrollbars = oui');
if (cible> = 4) {
if (if (Navigator.appname == "netscape") {{
varmachakfull = window.open (autre, "Machakfull", 'Scrollbars = Yes', 'width =' + x + ', height =' + y + ', top = 0, gauche = 0');
Machakfull.moveto (0,0);
Machakfull.Resizeto (x, y);}
if (Navigator.appname == "Microsoft Internet Explorer")
Window.open (c'est-à-dire, "Machakfull", "FullScreen = Oui");
}
else window.open (autre, "sub", 'scrollbars = oui');
}
Fonction mm_gotourl () {//v3.0
var i, args = mm_gotourl.arguments;
pour (i = 0; i <(args.length-); i + = 2) ev_r (args [i] + ". location = '" + args [i + 1] + "'");
}
// ->
</cript>
</ head>
<corps bgcolor = "# 3366cc" scroll = noonLoad = "Machakfull ('/ bbs /', '')">
------------------------------------------------ - - -------------------------------------------------- -------------------------------------------------- -------------------------------------------------
<cript>
Window.open ('/', '', 'fullScreen = 1');
window.close ();
</cript>
7, boîte de dialogue Web
Copier le code du code comme suit:
<cript>
window.onload = function () {
VarFeatures = 'Status: 0; DialogWidth: 470px; DialogHeight: 470px; Dialogtop: 100px; Dialogleft: 100px; Resizable: 0; Scroll: 0; Centre: 1'; : :::::::::::::::::::::::::::::::::::- : :::::::::::::::::::::::::::::::::::- : ::::::::::::::
showModelessDialog ("http: //www.aspxhome/", fenêtre, fonctionnalités);
}
Fonction Show (Laasn)
{{
var obj;
obj = LaySn.Style;
obj.visibilité = «visible»;
}
Fonction cachée (Laysn)
{{
var obj;
obj = LaySn.Style;
obj.visibilité = 'Hidden';
}
</cript>
8. La fenêtre enfant s'ouvre et ferme la fenêtre parent
Copier le code du code comme suit:
<cript>
Window.open ('http://www.aspxhome.com/' ,'width=790, hauteur = 590');
Window.opner = null;
window.close ();
</cript>