간단한 쿠키지원 팝업 스크립트
* 부모창 스크립트 (부모창 아무곳에나 삽입)
<script type="text/javascript">
function pop_window(url,param){// 팝업 오픈 함수
var cookieName = url.replace(/(?:.*/)?((?:[^.s]*?))(?:.)(?:.*)/i,'$1');
if(!document.cookie.match(cookieName)){ // if(쿠키:cookieName가 저장되어 있지 않다면) 팝업창 열림
window.open(url,cookieName,param);
}
}
</script>
...
<script type="text/javascript">
setTimeout("pop_window('./pop/20120604.php','left=100,top=100,width=400,height=300,status=0,menubar=0,fullscreen=0,resizable=0,toolbar=0')",500); // 0.5초 시간지연 후에 팝업창이 열림 (시간지연 있는게 좋음)
/*
setTimeout("pop_window(url,param)",idletime);
- url : 팝업페이지 경로로 상대경로 혹은 절대경로로 지정할 수 있다.
- param : 창의 여러가지 속성을 지정할 수 있다. (예 : "left=100,top=100,width=400,height=300,status=0,menubar=0,fullscreen=0,resizable=0,toolbar=0" )
- idletime : 팝업이 뜨는 지연시간으로 지정한 밀리초 이후에 팝업이 나타난다. ( 500 = 0.5초 )
*/
</script>
* 팝업 띄우기 - 쿠키지원 (팝업창 아무곳에나 삽입)
<script type="text/javascript">
function setcookie(name, value, expireHours) {
var today = new Date();
today.setHours(today.getHours() + expireHours);
document.cookie = name + "=" + escape(value) + "; path=/; expires=" + today.toGMTString() + ";";
}
function goto(url_link) {
window.parent.location.href = url_link;
closeme();
}
function close12() {
setcookie(window.name, "checked" ,12); // 쿠키유효기간 12시간
closeme();
}
function closeme() {
if(navigator.appVersion.indexOf("MSIE 7.0") >= 0 || navigator.appVersion.indexOf("MSIE 8.0") >= 0) window.open("about:blank","_self").close();
else self.close();
}
</script>
...
<a href="javascript:goto('aaa.html');"><img src="aaa.jpg" alt="이벤트 페이지로 가기" border="0"></a>
<a href="javascript:close12();">하루동안 안보기</a>
<a href="javascript:closeme();">닫기</a>
==============
setTimeout("pop_window('팝업경로')",500);
본 스크립트는 팝업경로에 쓰인 파일의 파일명을 자동으로 인식하여 쿠키를 생성 및 조회합니다.
setTimeout("pop_window('./pop/20120604.php','left=100,top=100,width=400,height=300,status=0,menubar=0,fullscreen=0,resizable=0,toolbar=0')",500);
라고 된 경우 20120604라는 이름으로 지정된 쿠키가 이용됩니다.
쿠키는 해당 도메인의 루트를 기준으로 저장됩니다.
본 스크립트는 팝업창마다 쿠키 이름을 지정하고 관리하는 번거로움이 없습니다.
setTimeout을 팝업창마다 지정하기만 하면 됩니다.
문의 사항 및 오류가 있으면 댓글 달아 주세요.
<script type="text/javascript">
function pop_window(url,param){// 팝업 오픈 함수
var cookieName = url.replace(/(?:.*/)?((?:[^.s]*?))(?:.)(?:.*)/i,'$1');
if(!document.cookie.match(cookieName)){ // if(쿠키:cookieName가 저장되어 있지 않다면) 팝업창 열림
window.open(url,cookieName,param);
}
}
</script>
...
<script type="text/javascript">
setTimeout("pop_window('./pop/20120604.php','left=100,top=100,width=400,height=300,status=0,menubar=0,fullscreen=0,resizable=0,toolbar=0')",500); // 0.5초 시간지연 후에 팝업창이 열림 (시간지연 있는게 좋음)
/*
setTimeout("pop_window(url,param)",idletime);
- url : 팝업페이지 경로로 상대경로 혹은 절대경로로 지정할 수 있다.
- param : 창의 여러가지 속성을 지정할 수 있다. (예 : "left=100,top=100,width=400,height=300,status=0,menubar=0,fullscreen=0,resizable=0,toolbar=0" )
- idletime : 팝업이 뜨는 지연시간으로 지정한 밀리초 이후에 팝업이 나타난다. ( 500 = 0.5초 )
*/
</script>
* 팝업 띄우기 - 쿠키지원 (팝업창 아무곳에나 삽입)
<script type="text/javascript">
function setcookie(name, value, expireHours) {
var today = new Date();
today.setHours(today.getHours() + expireHours);
document.cookie = name + "=" + escape(value) + "; path=/; expires=" + today.toGMTString() + ";";
}
function goto(url_link) {
window.parent.location.href = url_link;
closeme();
}
function close12() {
setcookie(window.name, "checked" ,12); // 쿠키유효기간 12시간
closeme();
}
function closeme() {
if(navigator.appVersion.indexOf("MSIE 7.0") >= 0 || navigator.appVersion.indexOf("MSIE 8.0") >= 0) window.open("about:blank","_self").close();
else self.close();
}
</script>
...
<a href="javascript:goto('aaa.html');"><img src="aaa.jpg" alt="이벤트 페이지로 가기" border="0"></a>
<a href="javascript:close12();">하루동안 안보기</a>
<a href="javascript:closeme();">닫기</a>
==============
setTimeout("pop_window('팝업경로')",500);
본 스크립트는 팝업경로에 쓰인 파일의 파일명을 자동으로 인식하여 쿠키를 생성 및 조회합니다.
setTimeout("pop_window('./pop/20120604.php','left=100,top=100,width=400,height=300,status=0,menubar=0,fullscreen=0,resizable=0,toolbar=0')",500);
라고 된 경우 20120604라는 이름으로 지정된 쿠키가 이용됩니다.
쿠키는 해당 도메인의 루트를 기준으로 저장됩니다.
본 스크립트는 팝업창마다 쿠키 이름을 지정하고 관리하는 번거로움이 없습니다.
setTimeout을 팝업창마다 지정하기만 하면 됩니다.
문의 사항 및 오류가 있으면 댓글 달아 주세요.
댓글 1개
12년 전
좋은 자료 감사합니다
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 8130 | 9년 전 | 576 | ||
| 8129 |
|
9년 전 | 691 | |
| 8128 | 9년 전 | 546 | ||
| 8127 |
|
9년 전 | 592 | |
| 8126 | 9년 전 | 528 | ||
| 8125 | 9년 전 | 781 | ||
| 8124 |
|
9년 전 | 541 | |
| 8123 | 9년 전 | 526 | ||
| 8122 | 9년 전 | 456 | ||
| 8121 | 9년 전 | 565 | ||
| 8120 | 9년 전 | 482 | ||
| 8119 | 9년 전 | 572 | ||
| 8118 |
|
9년 전 | 649 | |
| 8117 |
|
9년 전 | 416 | |
| 8116 |
PASKRAN
|
9년 전 | 474 | |
| 8115 | 9년 전 | 471 | ||
| 8114 |
kiplayer
|
9년 전 | 608 | |
| 8113 | 9년 전 | 468 | ||
| 8112 |
|
9년 전 | 579 | |
| 8111 | 9년 전 | 416 | ||
| 8110 | 9년 전 | 457 | ||
| 8109 | 9년 전 | 388 | ||
| 8108 |
|
9년 전 | 568 | |
| 8107 |
|
9년 전 | 454 | |
| 8106 |
|
9년 전 | 457 | |
| 8105 | 9년 전 | 487 | ||
| 8104 |
|
9년 전 | 451 | |
| 8103 |
|
9년 전 | 452 | |
| 8102 |
|
9년 전 | 424 | |
| 8101 |
snshero
|
9년 전 | 811 | |
| 8100 | 9년 전 | 857 | ||
| 8099 | 9년 전 | 836 | ||
| 8098 | 9년 전 | 738 | ||
| 8097 | 9년 전 | 544 | ||
| 8096 | 9년 전 | 741 | ||
| 8095 | 9년 전 | 879 | ||
| 8094 | 9년 전 | 550 | ||
| 8093 | 9년 전 | 827 | ||
| 8092 | 9년 전 | 776 | ||
| 8091 | 9년 전 | 1163 | ||
| 8090 | 9년 전 | 786 | ||
| 8089 | 9년 전 | 1000 | ||
| 8088 | 9년 전 | 661 | ||
| 8087 | 9년 전 | 789 | ||
| 8086 | 9년 전 | 536 | ||
| 8085 | 9년 전 | 502 | ||
| 8084 | 9년 전 | 620 | ||
| 8083 | 9년 전 | 594 | ||
| 8082 | 9년 전 | 783 | ||
| 8081 | 9년 전 | 495 | ||
| 8080 | 9년 전 | 588 | ||
| 8079 | 9년 전 | 548 | ||
| 8078 | 9년 전 | 465 | ||
| 8077 | 9년 전 | 557 | ||
| 8076 | 9년 전 | 425 | ||
| 8075 | 9년 전 | 459 | ||
| 8074 | 9년 전 | 424 | ||
| 8073 | 9년 전 | 479 | ||
| 8072 | 9년 전 | 472 | ||
| 8071 |
o1o111
|
9년 전 | 920 | |
| 8070 | 9년 전 | 429 | ||
| 8069 | 9년 전 | 366 | ||
| 8068 | 9년 전 | 617 | ||
| 8067 | 9년 전 | 417 | ||
| 8066 | 9년 전 | 444 | ||
| 8065 | 9년 전 | 406 | ||
| 8064 | 9년 전 | 397 | ||
| 8063 | 9년 전 | 366 | ||
| 8062 | 9년 전 | 335 | ||
| 8061 | 9년 전 | 370 | ||
| 8060 | 9년 전 | 414 | ||
| 8059 | 9년 전 | 349 | ||
| 8058 | 9년 전 | 288 | ||
| 8057 | 9년 전 | 412 | ||
| 8056 | 9년 전 | 333 | ||
| 8055 | 9년 전 | 381 | ||
| 8054 | 9년 전 | 384 | ||
| 8053 | 9년 전 | 436 | ||
| 8052 | 9년 전 | 307 | ||
| 8051 | 9년 전 | 357 | ||
| 8050 | 9년 전 | 413 | ||
| 8049 | 9년 전 | 347 | ||
| 8048 | 9년 전 | 452 | ||
| 8047 | 9년 전 | 391 | ||
| 8046 | 9년 전 | 335 | ||
| 8045 | 9년 전 | 281 | ||
| 8044 | 9년 전 | 368 | ||
| 8043 | 9년 전 | 326 | ||
| 8042 | 9년 전 | 316 | ||
| 8041 | 9년 전 | 376 | ||
| 8040 | 9년 전 | 300 | ||
| 8039 | 9년 전 | 341 | ||
| 8038 | 9년 전 | 283 | ||
| 8037 | 9년 전 | 428 | ||
| 8036 | 9년 전 | 516 | ||
| 8035 | 9년 전 | 449 | ||
| 8034 | 9년 전 | 410 | ||
| 8033 | 9년 전 | 369 | ||
| 8032 | 9년 전 | 475 | ||
| 8031 | 9년 전 | 365 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기