간단한 쿠키지원 팝업 스크립트
* 부모창 스크립트 (부모창 아무곳에나 삽입)
<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년 전
좋은 자료 감사합니다
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6630 |
차가운바람
|
12년 전 | 1171 | |
| 6629 | 12년 전 | 1168 | ||
| 6628 |
put777
|
12년 전 | 650 | |
| 6627 |
|
12년 전 | 704 | |
| 6626 | 12년 전 | 1619 | ||
| 6625 |
|
12년 전 | 727 | |
| 6624 |
미켈란젤로의왼손
|
12년 전 | 493 | |
| 6623 |
|
12년 전 | 1052 | |
| 6622 | 12년 전 | 1402 | ||
| 6621 |
차가운바람
|
12년 전 | 642 | |
| 6620 | 12년 전 | 743 | ||
| 6619 |
|
12년 전 | 980 | |
| 6618 | 12년 전 | 1751 | ||
| 6617 | 12년 전 | 646 | ||
| 6616 |
차가운바람
|
12년 전 | 904 | |
| 6615 | 12년 전 | 2858 | ||
| 6614 | 12년 전 | 623 | ||
| 6613 |
강명구베드로
|
12년 전 | 535 | |
| 6612 |
|
12년 전 | 431 | |
| 6611 | 12년 전 | 1215 | ||
| 6610 | 12년 전 | 1034 | ||
| 6609 | 12년 전 | 3686 | ||
| 6608 |
|
12년 전 | 835 | |
| 6607 | 12년 전 | 700 | ||
| 6606 | 12년 전 | 569 | ||
| 6605 | 12년 전 | 459 | ||
| 6604 | 12년 전 | 979 | ||
| 6603 |
geektoo
|
12년 전 | 710 | |
| 6602 | 12년 전 | 846 | ||
| 6601 | 12년 전 | 374 | ||
| 6600 | 12년 전 | 420 | ||
| 6599 | 12년 전 | 574 | ||
| 6598 | 12년 전 | 954 | ||
| 6597 | 12년 전 | 948 | ||
| 6596 | 12년 전 | 437 | ||
| 6595 | 12년 전 | 796 | ||
| 6594 | 12년 전 | 4577 | ||
| 6593 | 12년 전 | 2582 | ||
| 6592 | 12년 전 | 835 | ||
| 6591 | 12년 전 | 597 | ||
| 6590 |
|
12년 전 | 1407 | |
| 6589 | 12년 전 | 780 | ||
| 6588 |
GINUSSOFT
|
12년 전 | 5135 | |
| 6587 | 12년 전 | 6219 | ||
| 6586 | 12년 전 | 1053 | ||
| 6585 | 12년 전 | 815 | ||
| 6584 | 12년 전 | 474 | ||
| 6583 |
|
12년 전 | 986 | |
| 6582 | 12년 전 | 879 | ||
| 6581 | 12년 전 | 851 | ||
| 6580 | 12년 전 | 626 | ||
| 6579 |
알랑가몰라
|
12년 전 | 941 | |
| 6578 | 12년 전 | 1338 | ||
| 6577 | 12년 전 | 1511 | ||
| 6576 |
경dragon
|
12년 전 | 783 | |
| 6575 | 12년 전 | 1893 | ||
| 6574 | 12년 전 | 692 | ||
| 6573 | 12년 전 | 999 | ||
| 6572 |
|
12년 전 | 1677 | |
| 6571 |
CTOMAN
|
12년 전 | 1971 | |
| 6570 | 12년 전 | 1741 | ||
| 6569 | 12년 전 | 1900 | ||
| 6568 | 12년 전 | 2412 | ||
| 6567 | 12년 전 | 1037 | ||
| 6566 |
lainfox
|
12년 전 | 1540 | |
| 6565 | 12년 전 | 3664 | ||
| 6564 |
제주프라이스
|
12년 전 | 1544 | |
| 6563 | 12년 전 | 1576 | ||
| 6562 |
프로프리랜서
|
12년 전 | 1358 | |
| 6561 |
프로프리랜서
|
12년 전 | 980 | |
| 6560 |
프로프리랜서
|
12년 전 | 1237 | |
| 6559 |
프로프리랜서
|
12년 전 | 1148 | |
| 6558 |
프로프리랜서
|
12년 전 | 1364 | |
| 6557 |
프로프리랜서
|
12년 전 | 1988 | |
| 6556 |
프로프리랜서
|
12년 전 | 1531 | |
| 6555 |
프로프리랜서
|
12년 전 | 1375 | |
| 6554 |
프로프리랜서
|
12년 전 | 3899 | |
| 6553 |
프로프리랜서
|
12년 전 | 1522 | |
| 6552 | 12년 전 | 858 | ||
| 6551 |
왕초보sasa
|
12년 전 | 1550 | |
| 6550 |
왕초보sasa
|
12년 전 | 645 | |
| 6549 |
왕초보sasa
|
12년 전 | 917 | |
| 6548 | 12년 전 | 1306 | ||
| 6547 | 12년 전 | 1205 | ||
| 6546 | 12년 전 | 5170 | ||
| 6545 | 12년 전 | 2527 | ||
| 6544 |
AnnieK
|
12년 전 | 1792 | |
| 6543 |
베르무트7
|
12년 전 | 655 | |
| 6542 |
오늘도망했다
|
12년 전 | 2242 | |
| 6541 | 12년 전 | 823 | ||
| 6540 | 12년 전 | 1147 | ||
| 6539 | 12년 전 | 856 | ||
| 6538 |
senseme
|
12년 전 | 3383 | |
| 6537 | 12년 전 | 783 | ||
| 6536 | 12년 전 | 3673 | ||
| 6535 | 12년 전 | 1360 | ||
| 6534 | 12년 전 | 1630 | ||
| 6533 | 12년 전 | 2255 | ||
| 6532 |
냐옹이사범
|
12년 전 | 2314 | |
| 6531 | 12년 전 | 575 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기