간단한 쿠키지원 팝업 스크립트
* 부모창 스크립트 (부모창 아무곳에나 삽입)
<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년 전
좋은 자료 감사합니다
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6830 |
112211dd
|
11년 전 | 796 | |
| 6829 |
진짜다진짜가나타남
|
11년 전 | 1217 | |
| 6828 | 11년 전 | 828 | ||
| 6827 |
봉보로봉봉
|
11년 전 | 919 | |
| 6826 |
jinion
|
11년 전 | 831 | |
| 6825 | 11년 전 | 809 | ||
| 6824 |
yunkiri486
|
11년 전 | 728 | |
| 6823 |
2donggalbi
|
11년 전 | 858 | |
| 6822 | 11년 전 | 856 | ||
| 6821 | 11년 전 | 805 | ||
| 6820 | 11년 전 | 3110 | ||
| 6819 | 11년 전 | 1260 | ||
| 6818 | 11년 전 | 520 | ||
| 6817 |
|
11년 전 | 618 | |
| 6816 | 11년 전 | 2085 | ||
| 6815 | 11년 전 | 1219 | ||
| 6814 | 11년 전 | 872 | ||
| 6813 | 11년 전 | 618 | ||
| 6812 |
|
11년 전 | 990 | |
| 6811 | 11년 전 | 592 | ||
| 6810 | 11년 전 | 1544 | ||
| 6809 |
낚시가좋아
|
11년 전 | 1051 | |
| 6808 | 11년 전 | 448 | ||
| 6807 | 11년 전 | 779 | ||
| 6806 |
Unhappy
|
11년 전 | 1779 | |
| 6805 | 11년 전 | 1614 | ||
| 6804 | 11년 전 | 1135 | ||
| 6803 | 11년 전 | 579 | ||
| 6802 |
asdfg
|
11년 전 | 1148 | |
| 6801 |
아트귀농인
|
11년 전 | 507 | |
| 6800 | 11년 전 | 2561 | ||
| 6799 | 11년 전 | 1360 | ||
| 6798 | 11년 전 | 1476 | ||
| 6797 | 11년 전 | 632 | ||
| 6796 |
purple63
|
11년 전 | 435 | |
| 6795 | 11년 전 | 2639 | ||
| 6794 |
커네드커네드
|
11년 전 | 964 | |
| 6793 | 11년 전 | 412 | ||
| 6792 | 11년 전 | 2501 | ||
| 6791 | 11년 전 | 533 | ||
| 6790 | 11년 전 | 2265 | ||
| 6789 |
리아빌리티
|
11년 전 | 3105 | |
| 6788 | 11년 전 | 1346 | ||
| 6787 | 11년 전 | 683 | ||
| 6786 | 11년 전 | 392 | ||
| 6785 | 11년 전 | 724 | ||
| 6784 |
|
11년 전 | 854 | |
| 6783 | 11년 전 | 591 | ||
| 6782 | 11년 전 | 3659 | ||
| 6781 |
리아빌리티
|
11년 전 | 496 | |
| 6780 | 11년 전 | 541 | ||
| 6779 | 11년 전 | 492 | ||
| 6778 | 11년 전 | 4704 | ||
| 6777 |
바보온달123
|
11년 전 | 624 | |
| 6776 | 11년 전 | 935 | ||
| 6775 | 11년 전 | 738 | ||
| 6774 |
DANet
|
11년 전 | 645 | |
| 6773 | 11년 전 | 1562 | ||
| 6772 | 11년 전 | 1363 | ||
| 6771 | 11년 전 | 621 | ||
| 6770 | 11년 전 | 1162 | ||
| 6769 | 11년 전 | 960 | ||
| 6768 | 11년 전 | 696 | ||
| 6767 | 11년 전 | 590 | ||
| 6766 | 11년 전 | 1270 | ||
| 6765 |
크림나이트
|
11년 전 | 1005 | |
| 6764 | 11년 전 | 1558 | ||
| 6763 | 11년 전 | 2613 | ||
| 6762 | 11년 전 | 545 | ||
| 6761 |
|
11년 전 | 791 | |
| 6760 |
|
11년 전 | 719 | |
| 6759 | 11년 전 | 3354 | ||
| 6758 | 11년 전 | 1011 | ||
| 6757 | 11년 전 | 1275 | ||
| 6756 | 11년 전 | 897 | ||
| 6755 |
|
11년 전 | 575 | |
| 6754 |
|
11년 전 | 725 | |
| 6753 |
|
11년 전 | 1393 | |
| 6752 | 11년 전 | 609 | ||
| 6751 |
|
11년 전 | 655 | |
| 6750 |
|
11년 전 | 2031 | |
| 6749 | 11년 전 | 1222 | ||
| 6748 |
|
11년 전 | 1124 | |
| 6747 | 11년 전 | 1175 | ||
| 6746 | 11년 전 | 841 | ||
| 6745 |
|
11년 전 | 916 | |
| 6744 | 11년 전 | 855 | ||
| 6743 | 11년 전 | 1297 | ||
| 6742 | 11년 전 | 542 | ||
| 6741 |
Abilityarch
|
11년 전 | 612 | |
| 6740 | 11년 전 | 659 | ||
| 6739 |
leewin20
|
11년 전 | 1240 | |
| 6738 | 11년 전 | 511 | ||
| 6737 | 11년 전 | 1220 | ||
| 6736 | 11년 전 | 1262 | ||
| 6735 | 11년 전 | 551 | ||
| 6734 | 11년 전 | 1289 | ||
| 6733 |
RipperTNT
|
11년 전 | 1846 | |
| 6732 |
|
11년 전 | 1340 | |
| 6731 |
|
11년 전 | 1397 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기