window.location = "aaa.aspx"
يمكن فتح الطريقة أعلاه فقط على الصفحة الحالية.
form.target = "_ blank" ؛
form.action = "aaa.aspx" ؛
form.submit () ؛
window.top.location = url يمكن تحديثه وفتحه في النافذة الأصل.
طريقة window.Open غنية بالأناقة. هناك عيب لاستخدام نافذة. فتح في JS أنه من السهل أن يتم حظرها من قبل المتصفح. تقدم هذه المقالة طرقًا مختلفة لفتح النافذة الجديدة في JS.
1. افتح شاشة كاملة لنافذة جديدة
نسخ رمز رمز على النحو التالي:
<html> <head>
<title> الأزرق </title>
<script>
وظيفة ow (owurl) {
var tmp = window.open ("About: Blank" ، "" ، "fullscreen = 1")
TMP.Moveto (0،0) ؛
tmp.resizeto (screen.width+20 ، screen.hight) ؛
tmp.focus () ؛
tmp.location = owurl ؛
}
</script>
</head>
<body>
<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 </utton>
<TutononClight = "window.showmodelessdialog ('/red' ، '' ، 'dialogwidth: 800px ؛ dialogheight: 300px')
3. افتح الحجم الافتراضي
نسخ رمز رمز على النحو التالي:
<script>
// tmtc_winmaximizer
if (document.layers) {
var larg = screen.availwidth-10 ؛
var altez = screen.availheight-20 ؛}
آخر {
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. افتحه بشكل طبيعي وافتح نافذة موسيقى البوب
نسخ رمز رمز على النحو التالي:
<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>
<Porm>
<type type = "button" name = "button1" value = "cn-bruce" onClick = "Winopen ()">
</form>
------------------------------------------------- ------------------------------------------------- ------------------------------------------------- ---------------------------------------------
<a href =#onclick = window.open ('http: //www.aspxhome' ، 'target' ، 'param')> a </a>
5. نافذة كروم لا جدال في IE6 SP1
نسخ رمز رمز على النحو التالي:
<html xmlns: ie>
<meta http-equiv = "content-type" content = "text/html ؛ charset = gb2312">
<ie: تنزيل id = "include" style = "السلوك: 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 ؛ اللون: أسود ؛ الحدود: 2pxoutset ؛ على غرار الحدود: expression_r (onMouseout = onMouseup = function () {this.style.borderstyle = 'utmet'} ، onmousedown = function () {if (event (event (event . "؛" ؛
// بناء نافذة
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 = "Solid Black 1px" ؛
content = content.replace (/<a ([^>]*)>/g ، "<aonclick = 'parent.open (this.href) ؛ return false' $ 1>") ؛
temp += "<عرض الجدول = ارتفاع 100 ٪ = 100 ٪ cellpadding = 0cellspacing = 0 الحدود = 0>" "؛
Temp += "<Trstyle = '؛ font-size: 12px ؛ الخلفية:#0099cc ؛ الارتفاع: 20 ؛ المؤشر: default'ondblclick =/" max.innertext ==' 1 '؟' parent.if_max =! إرجاع false'oncontextMenu = 'return false'> "" ؛
temp += "<tdstyle = 'color: #ffffff ؛ padding-heft: 5px'> chromelessWindow for ie6 sp1 </td>" "؛
Temp += "<tdstyle = 'color: #fffff ؛ padding-right: 5px ؛'
temp += "<span id = help onClick =/" ALERT ('chromillyWindow for ie6 sp1 -ver 1.0 // ncode by windy_sk // n // nspecialthans for and "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 = 'maximum'> 1 </span> "" ؛
temp+= "<span id = closeOnClick = 'parent.opner = null ؛ parent.close ()' style =/"+cssttext+"font-family: system ؛ padding-right: 2px ؛/" "title = 'leable'> x </span> "" "؛
temp += "</td> </r> <tr> <tdcolspan = 2>" "؛
temp+= "<div id = includeStyle = 'overflow: scroll ؛ overflow-x: hidden ؛ overflow-y: auto ؛ الارتفاع: 100 ٪ ؛ العرض:"+cwidth+"" "" ؛
temp += المحتوى ؛
temp += "</viv>" ؛
temp += "</td> </tr> </lood>" "؛
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) {
إذا (الشحنة) {
new_cw.show (e.screen-drag_x ، e.screeny-drag_y ، cw_width ، cw_height) ؛
العودة كاذبة
}
}
وظيفة drag_down (e) {
إذا (e.button == 2) العودة ؛
if (new_cw.document.body.offsetwidth == screen.width && new_cw.document.offsetheight == screen.height)
drag_x = e.clientx ؛
drag_y = e.clienty ؛
الشحنة = صواب ؛
e.srcelement.setCapture () ؛
}
وظيفة drag_up (e) {
شحنة = خطأ ؛
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>
<head>
<meta http-equiv = "content-type" content = "text/html ؛ charset = gb2312">
<title> طريقة 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.availheight ؛
Target = parseflot (navigator.appversion.substring (navigator.appversion.indexof ('.')
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') ؛
}
الدالة mm_gotourl () {//v3.0
var i ، args = mm_gotourl.arguments ؛
لـ (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 ، مربع حوار الويب
نسخ رمز رمز على النحو التالي:
<script>
window.onload = function () {
varfeatures = 'الحالة: 0 ؛ حوار الوصايا: 470px ؛ حوار: 470px ؛ حوار: 100px ؛ dialogleft: ::::::::::::::::::::::::: :::::::::::::::::::::: ::::::::::::::::::::::::: :::::::::::::::::::::: ::::::::::::::
showmodlessdialog ("http: //www.aspxhome/" ، نافذة ، ميزات) ؛
}
عرض الوظيفة (LAASN)
{{
var obj ؛
OBJ = laysn.style ؛
obj.vibility = 'visible' ؛
}
وظيفة مخفية (Laysn)
{{
var obj ؛
OBJ = laysn.style ؛
obj.vibility = 'Hidden' ؛
}
</script>
8. نافذة الطفل تفتح وتغلق النافذة الأصل
نسخ رمز رمز على النحو التالي:
<script>
window.open ('http://www.aspxhome.com/''width=790 ، الارتفاع = 590') ؛
window.opner = null ؛
window.close () ؛
</script>