티스토리 뷰

■ window.open("팝업페이지명", "팝업이름", "옵션")
 
ex)
function naverPopUp() {
     window.open(
          "http://www.naver.com",
          "네이버 팝업",
          "
               width=800,           // 팝업창의 가로 길이
               height=600,          // 팝업창의 세로 길이
               toolbar=no,          // 툴바표시 여부 yes/no
               location=no,         // 사이트주소란 표시여부
               status=no,           // 상태표시줄 표시여부
               menuber=no,        // 메뉴바 표시여부
               scrollbars=no,      // 스크롤바 유무여부 auto/yes/no
               resizable=no,       // 팝업창 크기변경 여부
               top=100,               // 팝업창 표시 위치 위로부터 여백
               left=100                // 팝업창 표시 위치 좌로부터 여백
          "
     )
}
 
window.open("http://home.daeshin.ac.kr/nx/pass_yes.asp", "수시모집", "width=800, height=800, top=100, left=100, toolbar=no, location=no, status=no, menuber=no, scrollbars=no, resizable=no");;void(0); 
 
window.open("http://home.daeshin.ac.kr/nx/pass_yes.asp", "수시모집", "width=800, height=800, top=100, left=100"); 
 
< img src="/img/main/pc_virus.jpg" onClick="javascript:window.open("http://www.boho.or.kr/zombie_ani/main.htm","좀비PC","width=860, height=630, top=30, left=30, toolbar=no, location=no, status=no, menuber=no, scrollbars=no, resizable=no ")" style="cursor:pointer;" />
 
---------------------------------------------------------------------------------------------------------------------------------------------------------
 
■ 팝업창 전체창으로 띄우기
 
widthTemp = screen.width;
heightTemp = screen.height;
window.open("", "popup", "width="+widthTemp+", height="+heightTemp+", top=0, left=0, toolbar=no, location=no, status=no, menuber=no, scrollbars=yes, resizable=no");
 
---------------------------------------------------------------------------------------------------------------------------------------------------------
 
■ 쿠기를 사용하여 날짜가 변경되었으면 그팝업을 다시 띄우고 같은 날자면 팝업을 띄우지 않는다.
 
1. 팝업창을 띄울 곳에 적어 넣는다.
 
< script language="javascript">
< !--
function getCookie(name) {
    var Found = false;
    var start, end;
    var i = 0;
    while(i <= document.cookie.length) {
        start = i;
        end = start + name.length;
        if(document.cookie.substring(start, end) == name) {
            Found = true;
            break;
        }
        i++;
    }
    if(Found == true) {
        start = end + 1;
        end = document.cookie.indexOf(";", start)
        if(end < start) {
            end = document.cookie.length;
        }
        return document.cookie.substring(start, end)
    }
    return "";
}
 
 
var eventCookie = getCookie("popup");
if(eventCookie != "no") {
    window.open("http://www.naver.com", "popupName", "width=800, height=600 left=100 top=100");
}
-->
< /script> 
 
 
2. 띄울 팝업창 페이지에 적어 넣을 것 - 오늘 날짜를 설정하고 쿠키에 저장
 
< script language="javascript">
< !--
function setCookie(name, value, expiredays) {
    var todayDate = new Date();
    todayDate.setDate(todayDate.getDate() + expiredays);
    document.cookie = name + "=" + escape(value) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
function closeWin() {
    //if(document.form1.closeEvent.checked) {
        setCookie("popup", "no", 1);    // 1일간 쿠키 적용
    //}
    self.close();
}
-->
< /script> 

Total
Today
Yesterday
최근에 올라온 글
«   2025/01   »
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