간단한 쿠키지원 팝업 스크립트
* 부모창 스크립트 (부모창 아무곳에나 삽입)
<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년 전
좋은 자료 감사합니다
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 5630 | 13년 전 | 1070 | ||
| 5629 | 13년 전 | 2707 | ||
| 5628 | 13년 전 | 1287 | ||
| 5627 | 13년 전 | 1660 | ||
| 5626 | 13년 전 | 1293 | ||
| 5625 | 13년 전 | 1946 | ||
| 5624 | 13년 전 | 1365 | ||
| 5623 | 13년 전 | 950 | ||
| 5622 | 13년 전 | 422 | ||
| 5621 | 13년 전 | 13312 | ||
| 5620 | 13년 전 | 1193 | ||
| 5619 | 13년 전 | 3339 | ||
| 5618 | 13년 전 | 975 | ||
| 5617 | 13년 전 | 423 | ||
| 5616 | 13년 전 | 602 | ||
| 5615 |
Preware
|
13년 전 | 421 | |
| 5614 | 13년 전 | 554 | ||
| 5613 |
AMDbest
|
13년 전 | 4341 | |
| 5612 |
AMDbest
|
13년 전 | 6166 | |
| 5611 | 13년 전 | 874 | ||
| 5610 |
AMDbest
|
13년 전 | 4665 | |
| 5609 | 13년 전 | 968 | ||
| 5608 |
|
13년 전 | 487 | |
| 5607 | 13년 전 | 654 | ||
| 5606 | 13년 전 | 470 | ||
| 5605 | 13년 전 | 368 | ||
| 5604 | 13년 전 | 609 | ||
| 5603 |
갑수엔터테인먼트
|
13년 전 | 768 | |
| 5602 | 13년 전 | 427 | ||
| 5601 | 13년 전 | 510 | ||
| 5600 | 13년 전 | 934 | ||
| 5599 | 13년 전 | 7466 | ||
| 5598 |
PHPㅡASP프로그래머
|
13년 전 | 2699 | |
| 5597 | 13년 전 | 404 | ||
| 5596 |
hoinV
|
13년 전 | 994 | |
| 5595 | 13년 전 | 920 | ||
| 5594 | 13년 전 | 1061 | ||
| 5593 | 13년 전 | 4943 | ||
| 5592 |
|
13년 전 | 389 | |
| 5591 | 13년 전 | 892 | ||
| 5590 |
PHPㅡASP프로그래머
|
13년 전 | 2308 | |
| 5589 | 13년 전 | 1939 | ||
| 5588 |
바다로가자
|
13년 전 | 1637 | |
| 5587 |
PHPㅡASP프로그래머
|
13년 전 | 1825 | |
| 5586 | 13년 전 | 2744 | ||
| 5585 | 13년 전 | 398 | ||
| 5584 | 13년 전 | 1873 | ||
| 5583 | 13년 전 | 1306 | ||
| 5582 |
바다로가자
|
13년 전 | 3097 | |
| 5581 |
|
13년 전 | 3106 | |
| 5580 | 13년 전 | 921 | ||
| 5579 |
하하369
|
13년 전 | 3978 | |
| 5578 | 13년 전 | 1064 | ||
| 5577 | 13년 전 | 1232 | ||
| 5576 | 13년 전 | 1644 | ||
| 5575 |
가위바위보
|
13년 전 | 1593 | |
| 5574 |
danielle
|
13년 전 | 705 | |
| 5573 |
|
13년 전 | 860 | |
| 5572 | 13년 전 | 2777 | ||
| 5571 | 13년 전 | 834 | ||
| 5570 | 13년 전 | 1424 | ||
| 5569 |
|
13년 전 | 2134 | |
| 5568 | 13년 전 | 1958 | ||
| 5567 | 13년 전 | 679 | ||
| 5566 |
|
13년 전 | 1311 | |
| 5565 | 13년 전 | 3671 | ||
| 5564 | 13년 전 | 920 | ||
| 5563 | 13년 전 | 1373 | ||
| 5562 | 13년 전 | 872 | ||
| 5561 | 13년 전 | 1045 | ||
| 5560 |
PHPㅡASP프로그래머
|
13년 전 | 1530 | |
| 5559 | 13년 전 | 634 | ||
| 5558 |
there007
|
13년 전 | 1552 | |
| 5557 | 13년 전 | 1186 | ||
| 5556 |
후라보노보노
|
13년 전 | 742 | |
| 5555 | 13년 전 | 9132 | ||
| 5554 | 13년 전 | 827 | ||
| 5553 |
가을이군요
|
13년 전 | 716 | |
| 5552 |
|
13년 전 | 792 | |
| 5551 | 13년 전 | 1509 | ||
| 5550 |
후라보노보노
|
13년 전 | 914 | |
| 5549 |
|
13년 전 | 1014 | |
| 5548 | 13년 전 | 678 | ||
| 5547 | 13년 전 | 525 | ||
| 5546 | 13년 전 | 4609 | ||
| 5545 | 13년 전 | 906 | ||
| 5544 | 13년 전 | 1022 | ||
| 5543 | 13년 전 | 759 | ||
| 5542 | 13년 전 | 6633 | ||
| 5541 | 13년 전 | 807 | ||
| 5540 | 13년 전 | 1137 | ||
| 5539 | 13년 전 | 1116 | ||
| 5538 | 13년 전 | 2830 | ||
| 5537 | 13년 전 | 809 | ||
| 5536 | 13년 전 | 2705 | ||
| 5535 |
|
13년 전 | 1213 | |
| 5534 | 13년 전 | 1764 | ||
| 5533 |
꿈꾸는인생
|
13년 전 | 1331 | |
| 5532 | 13년 전 | 1496 | ||
| 5531 | 13년 전 | 1711 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기