티스토리 뷰

Develop/Language

[JavaScript] window.open()

빼인트 2010. 5. 3. 16:16
<script type="text/javascript">
/*
window.open(url:String, name:String, properties:String)
open 함수는 반드시 3개의 매개변수가 있고, 매개변수 순서는 지켜야 함.
name은 팝업창의 이름, 주로 프레임 문서의 Target으로 사용
name은 사용하지 않으려면 " " 만 표시해줍니다. 반드시 표시해야 함.
*/

function win() {
    window.open("http://ws.daum.net/", "", ""); //속성 지정하지 않은 기본창
}
 
function menu_win() {
    window.open("http://ws.daum.net//", "", "menubar=1"); //메뉴바 없는 팝업
}
 
function full_win() {
    window.open("http://ws.daum.net//", "", "fullscreen"); //풀스크린 방식
}
 
function channel_win() {
    window.open("http://ws.daum.net//", "", "channelmode"); //채널모드
}
 
function status_win() { // 상태표시바 있는 팝업
    window.open("http://ws.daum.net//", "", "width=400, height=300, status=1");
}
 
function popup_win1() { //크기 width400 height300 팝업창
    window.open("http://ws.daum.net//", "", "width=400, height=300");
}
 
function popup_win2() { //위치 left=500, top=400 에서 열리는 팝업창
    window.open("http://ws.daum.net//", "", "width=400, height=300, left=500, top=400");
}
 
function popup_win3() { //스크롤바 있는 팝업
    window.open("http://ws.daum.net//", "", "width=400, height=300, scrollbars=1");
}
 
function popup_win4() { //주소표시줄 있는 팝업
    window.open("http://ws.daum.net//", "", "width=400, height=300, left=100, location=1");
}
</script>
 
<body>
    <input type="button" value="속성 지정하지 않은 기본 창" onclick="win()">
    <input type="button" value="메뉴바 없는 팝업" onclick="menu_win()">
    <input type="button" value="풀스크린 팝업" onclick="full_win()">
    <input type="button" value="채널모드 팝업" onclick="channel_win()">
    <input type="button" value="상태표시바 있는 팝업" onclick="status_win()">
    <input type="button" value="width400 height300 팝업창" onclick="popup_win1()">
    <input type="button" value="위치 left=500, top=400 팝업창" onclick="popup_win2()">
    <input type="button" value="스크롤바 있는 팝업" onclick="popup_win3()">
    <input type="button" value="주소 입력 표시줄 있는 팝업" onclick="popup_win4()">
</body>

 

===========================================================
1. width : 창 가로길이 지정
2. height : 창 세로길이 지정
3. toolbar : 단축도구창 유무 지정(yes/no)
4. menubar : 메뉴창 유무 지정(yes/no)
5. location : 주소창 유무 지정(yes/no)
6. scrollbar : 스크롤바 유무지정(yes/no)
7. status : 아래 상태바창 유무지정(yes/no)
8. realzable : 창변형 유무 지정(yes/no)
9. fullscreen : 전체화면 유무 지정(yes/no)
10. chnnelmode=yes : 앞,뒤로 창최소화, 닫기등을 설정(F11키랑 같음)
11. left=0, top=0 : 창을 왼쪽 구석에 고정
===========================================================

window.open("URL명 ", "창이름", "속성");
winOpen1 = window.open("http://www.daum.net", "aaa", "width=300 height=400 menubar=no status=no");
winOpen1.close(); //open한 새 창을 닫을 때
widow.close(); //현재 창을 닫을 때

 

발췌 : http://arkforme.egloos.com/1485817

'Develop > Language' 카테고리의 다른 글

[JSP] checkbox 배열로 받기  (0) 2011.02.14
[JavaScript] 함수 모음  (0) 2010.12.12
PHP 날짜 계산 관련 함수  (0) 2010.12.08
[Java Script] 브라우저 내장 객체  (0) 2010.05.13
자바스크립트(Java Script)는 자바(Java)가 아니다  (0) 2010.04.30
HTTP Method  (0) 2010.03.06
[web.xml] Sample  (0) 2010.02.02
[web.xml] PackageSeparator 구분자 설정  (0) 2010.02.02
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함