Window.location = "aaa.aspx"
Приведенный выше метод может быть открыт только на текущей странице.
form.target = "_ blank";
form.action = "aaa.aspx";
form.submit ();
window.top.location = url может быть обновлен и открыт в родительском окне.
Метод окна. Существует недостаток в использовании Window.Open в JS, что его легко заблокировать браузером. Эта статья представляет различные методы, чтобы открыть новое окно в JS.
1. Откройте полный экран нового окна
Код кода копирования следующим образом:
<html> <голова>
<Title> Blue </title>
<Скрипт>
Функция 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>
<тело>
<ahref = "javascript: ow ('http://www.aspxhome.com/');">
Блог </a>
2. Откройте фиксированный размер нового окна
Код кода копирования следующим образом:
<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. Откройте размер по умолчанию
Код кода копирования следующим образом:
<Скрипт>
// tmtc_winmaximizer
if (document.layers) {
var larg = screen.availWidth-10;
var altez = screen.availeheight-20;}
еще {
var larg = screen.availWidth-2;
var altez = screen.availheight;}
Self.resizeto (arg, altez);
Self.moveto (0,0);
// tmtc_winmaximanerend
</script>
------------------------------------------------------ ------------------------------------------------------ ------------------------------------------------------ -
<scriptlanguage = "javascript">
<!-
Self.moveto (0,0)
Self.resizeto (screen.availwidth, screen.availheight)
//->
</script>
4. Откройте это нормально и откройте окно -опто
Код кода копирования следующим образом:
<scriptlanguage = "javascript">
Функция winopen () {
Mesg = open ("cnrose", "DisplayWindow", "Toolbar = no, menubar = no, local = no, scrollbars = no");
mesg.document.write (<gead> <title> Китайский ASP House </title> </head> ");
mesg.document.write ("<enter> http: //www.aspxhome </center>");
}
</script>
<Форма>
<input type = "button" name = "button1" value = "cn-bruce" onclick = "winopen ()">
</form>
-------------------------------------------------- ------------------------------------------------------ ------------------------------------------------------ -------------------------------------------------
<A href =#onclick = window.open ('http: //www.aspxhome', 'target', 'param')> a </a>
5. Hromeless Window для IE6 SP1
Код кода копирования следующим образом:
<Html xmlns: т.е.>
<meta http-equiv = "content-type" content = "text/html; charset = gb2312">
<IE: скачать id = "include" style = "поведение: url (#default#скачать)" /> />
<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; цвет: черный; . ";"; ";
// Построение окна
Include.startdownload (cw_url, function (source) {content = source});
функция insert_content () {
var test = "" ;;
Cw_body.style.overflow = "hidden";
Cw_body.style.backgroundcolor = "White";
CW_BODY.STYLE.BORDER = "SOLIT BLACK 1PX";
Content = content.replace (/<a ([^>]*)>/g, "<aonclick = 'parent.open (this.href); вернуть false' $ 1>");
Temp += "<Table ширина = 100% высота = 100% CellPadding = 0cellSpacing = 0 border = 0>" ";
temp += "<trStyle = '; font-size: 12px; фон:#0099cc; высота: 20; курсор: default'ondblclick =/" max.innertext ==' 1 '?' 2 ':': 1 '; Parent.if_max =! Вернуть false'oncontextmenu = 'вернуть false'> "";
Temp += "<tdstyle = 'color: #ffffff; padding-heft: 5px'> chromelesswindow для ie6 sp1 </td>" ";
Temp += "<tdstyle = 'color: #fffff;
Temp += "<span id = help onclick =/" alert ('chromelesswindow для IE6 sp1 -ver 1.0 // ncode от windy_sk // n // nspecialthans для и "style =/" "" "" "" "" + CSSTTEXT+ "FONT-Family: System; Padding-Right: 2px;/">?
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'? "Style =/"+cssttext+"font-family: webdings;/" title = 'максимум'> 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-y: auto; высота: 100%; ширина:"+cwidth+"'" "";
temp += content;
temp += "</div>";
temp += "</td> </tr> </table>" ";
Cw_body.innerhtml = temp;
}
setTimeout ("insert_content ()", 1000);
var if_max = true;
функция 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";
}
} Еще {
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;
// переместить окно
var drag_x, drag_y, draging = false
Функция Drag_Move (e) {
if (перетаскивание) {
New_cw.show (e.screen-drag_x, e.screeny-drag_y, cw_width, cw_height);
Вернуть ложь;
}
}
Функция 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 ();
}
функция Drag_UP (e) {
перетаскивание = 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, откройте полный экран
Код кода копирования следующим образом:
<html>
<голова>
<meta http-equiv = "content-type" content = "text/html; charset = gb2312">
<TILE> JS Метод открытия новой коллекции кодов окон - China ASP Home - http: //www.aspxhome </title>
<link href = "index.css" rel = "stylesheet" type = "text/css">
<script language = "javascript" type = "text/javascript">
<!-
Функция machakfull (т.е. другие) {
x = screen.availWidth;
y = screen.avelheight;
target = parseflot (navigator.appversion.substring (navigator.appversion.indexof ('.')-1, navigator.length));););
If ((navigator.appversion.indexof ("mac")! = -1) && (navigator.userages.indexof ("msie")! = -1) && (parseint (navigator.appversion))
Window.open (другой, "sub", 'scrollbars = yes');
if (target> = 4) {
if (if (navigator.appname == "netscape") {{{
varmachakfull = window.open (другое, "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 (т.е. "Machakfull", "fullScreen = yes");
}
else window.open (другое, "sub", 'scrollbars = yes');
}
Function mm_gotourl () {//v3.0
var i, args = mm_gotourl.arguments;
for (i = 0; i <(args.length-); i+= 2) eval_r (args [i]+". location = '"+args [i+1]+"'");
}
//->
</script>
</head>
<body bgcolor = "#3366cc" scroll = loonload = "machakfull ('/bbs/', '')">
-------------------------------------------------- ------------------------------------------------------ ------------------------------------------------------ -------------------------------------------------
<Скрипт>
Window.open ('/', '', 'fullScreen = 1');
window.close ();
</script>
7, веб -диалоговое окно
Код кода копирования следующим образом:
<Скрипт>
window.onload = function () {
varFeatures = 'Статус: 0; Dialogwidth: 470px; Dialogheight: 470px; Dialogtop: 100px; Dialogleft: 100px; переселенная: 0; прокрутка: 0; Центр: 1'; ::::::::::::::::: ::::::::::::::::: ::::::::::::::
ShowmodelessDialog ("http: //www.aspxhome/", window, функции);
}
Функция шоу (Laasn)
{{
var obj;
obj = laysn.style;
obj.visibility = 'visible';
}
Функция скрыта (Laysn)
{{
var obj;
obj = laysn.style;
obj.visibility = 'hidden';
}
</script>
8. Детское окно открывается и закрывает родительское окно
Код кода копирования следующим образом:
<Скрипт>
Window.open ('http://www.aspxhome.com/','width=790, высота = 590');
Window.opner = null;
window.close ();
</script>