Develop
2013.11.18 18:32

[js] window.open() 속성 사용 방법

조회 수 14815 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
# Syntax
window.open(URL,name,specs,replace);


# name
- "_blank" : 새로운 창으로 로드 (Default)
- "_parent" : 부모 프레임으로 로드
- "_self" : 현재 창에서 로드
- "_top" : 가장 최 상위 프레임으로 로드
- name : The name of the window (Note: the name does not specify the title of the new window)

# specs
- width : 창 가로길이 지정 [no,yes(생김)] 
- height : 창 세로길이 지정 [no,yes(생김)] 
- toolbar : 단축도구창 유무지정 [no,yes(생김)] 
- menubar : 메뉴창 유무지정 [no,yes(생김)] 
- location : 주소창 유무지정 [no,yes(생김)] 
- scollbars : 스크롤바 지정 [no,yes(생김)] 
- status : 아래 상태바창 유무지정 [no,yes(생김)] 
- resizable : 창변형 유무지정 [no,yes(생김)] 
- fullscreen : 전체화면 유무지정 [no,yes(생김] 
- channelmode=yes : 앞&뒤로,창최소화.닫기등을 설정(F11번 키랑 같음) 
- left=0,top=0 : 창을 고정시킨다.왼쪽 구석에 고정 

# replace
- true : URL replaces the current document in the history list
- false : URL creates a new entry in the history list


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

function win() {
    //속성 지정하지 않은 기본창
    window.open("https://www.hooni.net/", "", "");
}

function menu_win() {
    //메뉴바 없는 팝업
    window.open("https://www.hooni.net/", "", "menubar=1");
}

function full_win() {
    //풀스크린 방식
    window.open("https://www.hooni.net/", "", "fullscreen");
} 

function channel_win() {
    //채널모드
    window.open("https://www.hooni.net/", "", "channelmode");
}

function status_win() {
    //상태표시바 있는 팝업
    window.open("https://www.hooni.net/", "",
        "width=400, height=300, status=1");
} 

function popup_win1() {
    //크기 width400 height300 팝업창
    window.open("https://www.hooni.net/", "",
        "width=400, height=300"); 
} 

function popup_win2() {
    //위치 left=500, top=400 에서 열리는 팝업창
    window.open("https://www.hooni.net/", "",
        "width=400, height=300, left=500, top=400");
} 


function popup_win3() {
    //스크롤바 있는 팝업
    window.open("https://www.hooni.net/", "",
        "width=400, height=300, scrollbars=1");
} 


function popup_win4() {
    //주소표시줄 있는 팝업
    window.open("https://www.hooni.net/", "",
        "width=400, height=300, left=100, location=1");
} 
</script> 


# HTML 코드 예제
<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="w:400, h:300 팝업" 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>

[출처] http://www.w3schools.com/jsref/met_win_open.asp
?

  1. [js] 간단한 게임 프로토타입 (HTML5 와는 무관)

    Date2013.04.23 CategoryDevelop Byhooni Views16353
    Read More
  2. [android] 안드로이드 어플 모음 ㅎㅎ

    Date2013.04.23 CategoryDevelop Byhooni Views16340
    Read More
  3. [c++][mfc] 파일 입출력 샘플 (한줄씩 읽어서 다른 파일에 쓰기)

    Date2013.04.23 CategoryDevelop Byhooni Views16161
    Read More
  4. [unix] 로그파일 정리 쉘스크립트

    Date2014.02.19 CategoryDevelop Byhooni Views16110
    Read More
  5. [web] URL 인코딩 방법.. 테이블.. ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views16033
    Read More
  6. [css] z-index에 설정할 수 있는 최대값?

    Date2013.12.20 CategoryDevelop Byhooni Views15952
    Read More
  7. [ios] iOS In App Purchase #1 (코드 구현 전 웹 설정 작업)

    Date2013.11.20 CategoryDevelop Byhooni Views15909
    Read More
  8. [unix] 날짜 관련 쉘 명령어 (특정일 또는 +-시간, 날짜 계산된 값)

    Date2013.04.23 CategoryDevelop Byhooni Views15853
    Read More
  9. [ios] iOS In App Purchase 코드 부분 샘플 1

    Date2013.11.20 CategoryDevelop Byhooni Views15826
    Read More
  10. [ios] iOS In App Purchase #2 (코드 구현)

    Date2013.11.20 CategoryDevelop Byhooni Views15824
    Read More
  11. [api] 인스타그램에서 최신 이미지 가져오기 (Using Instagram API)

    Date2018.04.05 CategoryDevelop Byhooni Views15801
    Read More
  12. [C] C언어의 조건 연산자(Conditional Operator)

    Date2003.04.23 CategoryDevelop Byhooni Views15738
    Read More
  13. [ios] Objective-C에서 SQLite 사용하기..

    Date2013.04.23 CategoryDevelop Byhooni Views15612
    Read More
  14. [c] vc++ 에서 clrscr(), gotoxy() 함수 사용하기..

    Date2013.04.23 CategoryDevelop Byhooni Views15246
    Read More
  15. [ios] Hybrid 앱 스터디 발표 자료

    Date2013.09.06 CategoryDevelop Byhooni Views15179
    Read More
  16. [php] 쉘에서 실행할 때 인수(파라미터) 받기..

    Date2003.04.23 CategoryDevelop Byhooni Views15124
    Read More
Board Pagination Prev 1 ... 9 10 11 12 13 ... 53 Next
/ 53