Window.location = "aaa.aspx"
위의 메소드는 현재 페이지에서만 열 수 있습니다. 가장 간단한 것은 다음 방법을 사용하는 것입니다.
form.target = "_ blank";
form.action = "aaa.aspx";
form.submit ();
window.top.location = URL은 iframe의 페이지의 상위 창에서 열 수 있습니다.
Window.open 메소드는 스타일이 풍부합니다. Window.open을 사용하는 데 불리한 점이 있습니다. 브라우저에서 쉽게 차단할 수 있습니다. 이 기사는 JS에서 새 창을 열 수있는 다양한 방법을 소개합니다.
1. 새 창의 전체 화면을 엽니 다
다음과 같이 코드 코드를 복사하십시오.
<html> <head>
<title> 블루 </제목>
<cript>
함수 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;
}
</스크립트>
</head>
<body>
<ahref = "javaScript : ow ( 'http://www.aspxhome.com/');">
블로그 </a>
2. 새 창의 고정 크기를 엽니 다
다음과 같이 코드 코드를 복사하십시오.
<buttonclick = "window.open ( '/red/', '', 'width = 800, height = 300')"> Open1 </button>
<button onclight = "varnewwin = wind
<butononClight = "window.showModelessDialog ( '/red', '', 'dialogwidth : 800px; 대화 상자 : 300px')"> Open3 </button>
3. 기본 크기를 엽니 다
다음과 같이 코드 코드를 복사하십시오.
<cript>
// 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
</스크립트>
--------------------------------------------------------- --------------------------------------------------------- --------------------------------------------------------- -
<scriptLanguage = "JavaScript">
<!-
self.moveto (0,0)
self.resizeto (screen.availwidth, screen.availheight)
//->
</스크립트>
4. 정상적으로 열고 팝 -UP 창을 엽니 다.
다음과 같이 코드 코드를 복사하십시오.
<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>");
}
</스크립트>
<양식>
<입력 유형 = "버튼"이름 = "button1"value = "cn-bruce"onclick = "winopen ()">
</form>
-------------------------------------------- --------------------------------------------------------- --------------------------------------------------------- -------------------------------------------------------------
<a href =#onclick = wind
5. IE6 SP1의 크로스리스 윈도우
다음과 같이 코드 코드를 복사하십시오.
<html xmlns : IE>
<meta http-equiv = "content-type"content = "text/html; charset = gb2312">
<IE : Download 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 csstext = "margin : 1px; color : black; border : 2pxoutset; border 스타일 : expression_r (onMouseOut = onMouseUp = function () {this.style.borderstyle = 'Octset'}, onMousEdown = function () {if (이벤트) .THING.STYLE. ";";
// 빌드 창
include.startDownload (cw_url, function (source) {content = source});
함수 insert_content () {
var test = "";;
cw_body.style.overflow = "Hidden";
cw_body.style.backgroundcolor = "화이트";
cw_body.style.border = "solid black 1px";
content = content.replace (/<a ([^>]*)>/g, "<aonclick = 'parent.open (this.href); return false'$ 1>");
temp += "<테이블 너비 = 100% 높이 = 100% 셀 패딩 = 0cellspacing = 0 경계 = 0>";
temp += "<trstyle = '; font-size : 12px; 배경 :#0099cc; 높이 : 20; cursor : default'OndBlClick =/"max.innertext =='1 ':': 1 '; parent.if_max =! If_max; chow_cw (); "onmouseup = 'parent.drag_move (event)'onmousedown = 'parent.drag_down' 'onselectStart =' return false'oncontextMenu = 'return false'> "";
temp += "<tdstyle = 'color : #ffffff; Padding-heft : 5px'> IE6 sp1 </td>" "의 Chromelesswindow;
temp += "<tdstyle = 'color : #ffffff; padding-right : 5px;';
temp += "<span id = help onclick =/"alert ( 'is6 sp1 -ver 1.0 // ncode by windy_sk // nspecialthans for 및 "style =/" "" "" "" "" " + CSSTTEXT+ "FONT-FAMILY : SYSTEM; PADDING-RIGHT : 2PX;/">;
temp+= "<spanid = min = 'parent.new_cw.hide (); parent.blur ()'style =/"+cstetext+"font-family : webdings;/"title = '최소'> 0 </span> " ;
Temp += <spanid = this.innertext == '1': '1'; "style =/"+cssttext+"font-family : webdings;/"title = 'maximum'> 1 </span> ";
temp+= "<span id = closeonClick = 'parent.opner = null; parent.close () style =/"+cssttext+"font-family : 시스템; 패딩-오른쪽 : 2px;/" "title ='close '> x </span> "" ";
temp += "</td> </tr> <tr> <tdcolspan = 2>" ";
temp+= "<div id = includestyle = '오버 플로우 : 스크롤; 오버 플로우 -x : 숨겨진; 오버 플로우 -Y : 자동; 높이 : 100%; 너비 :"+cwidth+"'" "";
임시 += 내용;
임시 += "</div>";
temp += "</td> </tr> </table>" ";
cw_body.innerhtml = temp;
}
settimeout ( "insert_content ()", 1000);
var if_max = true;
함수 show_cw () {
Window.Moveto (10000, 10000);
if (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.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) 반환;
if (new_cw.document.body.offsetwidth == screen.width && new_cw.document.body.offsetheight == screen.height) return;
drag_x = e.clientx;
drag_y = E.Clienty;
드래그 = true;
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;
}
</스크립트>
</html>
6, 전체 화면을 엽니 다
다음과 같이 코드 코드를 복사하십시오.
<html>
<헤드>
<meta http-equiv = "content-type"content = "text/html; charset = gb2312">
<title> js 새로운 창 코드 수집을 여는 방법 -Sian ASP 홈 -http : //www.aspxhome </title>
<link href = "index.css"rel = "스타일"유형 = "text/css">
<script language = "javaScript"type = "text/javaScript">
<!-
기능 machakfull (즉, 기타) {
x = screen.availwidth;
y = screen.availheight;
targe = 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 = 예');
if (target> = 4) {
if (navigator.appName == "netscape") {
varmachakfull = wind
machakfull.Moveto (0,0);
machakfull.resizeto (x, y);}
if (navigator.appName == "Microsoft Internet Explorer")
Window.open (즉, "Machakfull", "fullScreen = 예");
}
else window.open (기타, "sub", 'scrollbars = 예');
}
함수 mm_gotourl () {//v3.0
var i, args = mm_gotourl.arguments.mm_returnvalue = false;
for (i = 0; i <(args.length-); i+= 2) eval_r (args [i]+". 위치 = '"+args [i+1]+"'");
}
//->
</스크립트>
</head>
<body bgcolor = "#3366cc"scroll = noonload = "machakfull ( '/bbs/', '')">
-------------------------------------------- --------------------------------------------------------- --------------------------------------------------------- -------------------------------------------------------------
<cript>
Window.open ( '/', '', 'fullScreen = 1');
Window.Close ();
</스크립트>
7, 웹 대화 상자
다음과 같이 코드 코드를 복사하십시오.
<cript>
Window.onload = function () {
varfeatures = 'status : 0; dialogwidth : 470px; dialogheight : 470px; dialogtop : 100px; dialogleft : 100px; Resizedable : 0; 센터 : 1';
showmodelessDialog ( "http : //www.aspxhome/", 창, 특징);
}
기능 쇼 (Laasn)
{{
var obj;
obj = laysn.style;
obj.visibility = '가시적';
}
HIDDEN (Laysn) 기능
{{
var obj;
obj = laysn.style;
obj.visibility = '숨겨진';
}
</스크립트>
8. 자식 창이 열리고 부모 창을 닫습니다.
다음과 같이 코드 코드를 복사하십시오.
<cript>
wind
Window.opner = null;
Window.Close ();
</스크립트>