간단한 쿠키지원 팝업 스크립트
* 부모창 스크립트 (부모창 아무곳에나 삽입)
<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년 전
좋은 자료 감사합니다
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 5930 | 12년 전 | 4640 | ||
| 5929 | 12년 전 | 7839 | ||
| 5928 | 12년 전 | 787 | ||
| 5927 | 12년 전 | 1415 | ||
| 5926 | 12년 전 | 1831 | ||
| 5925 |
김준수사랑
|
13년 전 | 1250 | |
| 5924 |
|
13년 전 | 2760 | |
| 5923 | 13년 전 | 959 | ||
| 5922 | 13년 전 | 1166 | ||
| 5921 | 13년 전 | 658 | ||
| 5920 | 13년 전 | 1180 | ||
| 5919 |
|
13년 전 | 1374 | |
| 5918 | 13년 전 | 12588 | ||
| 5917 |
프로프리랜서
|
13년 전 | 1099 | |
| 5916 |
프로프리랜서
|
13년 전 | 4624 | |
| 5915 |
프로프리랜서
|
13년 전 | 1604 | |
| 5914 |
프로프리랜서
|
13년 전 | 653 | |
| 5913 |
프로프리랜서
|
13년 전 | 932 | |
| 5912 |
프로프리랜서
|
13년 전 | 3746 | |
| 5911 |
프로프리랜서
|
13년 전 | 925 | |
| 5910 |
|
13년 전 | 4583 | |
| 5909 |
수야3019
|
13년 전 | 671 | |
| 5908 | 13년 전 | 834 | ||
| 5907 | 13년 전 | 1233 | ||
| 5906 | 13년 전 | 8757 | ||
| 5905 |
프로프리랜서
|
13년 전 | 1473 | |
| 5904 | 13년 전 | 2496 | ||
| 5903 | 13년 전 | 1652 | ||
| 5902 | 13년 전 | 1927 | ||
| 5901 | 13년 전 | 2013 | ||
| 5900 |
프로프리랜서
|
13년 전 | 1090 | |
| 5899 |
프로프리랜서
|
13년 전 | 1278 | |
| 5898 | 13년 전 | 17672 | ||
| 5897 | 13년 전 | 2333 | ||
| 5896 | 13년 전 | 4356 | ||
| 5895 | 13년 전 | 1691 | ||
| 5894 | 13년 전 | 2100 | ||
| 5893 |
프로프리랜서
|
13년 전 | 2158 | |
| 5892 | 13년 전 | 16039 | ||
| 5891 |
bitmaster
|
13년 전 | 1080 | |
| 5890 |
프로프리랜서
|
13년 전 | 946 | |
| 5889 |
|
13년 전 | 723 | |
| 5888 | 13년 전 | 1618 | ||
| 5887 |
|
13년 전 | 3199 | |
| 5886 | 13년 전 | 3448 | ||
| 5885 | 13년 전 | 2109 | ||
| 5884 | 13년 전 | 5651 | ||
| 5883 | 13년 전 | 2821 | ||
| 5882 | 13년 전 | 6029 | ||
| 5881 | 13년 전 | 1636 | ||
| 5880 | 13년 전 | 20716 | ||
| 5879 | 13년 전 | 903 | ||
| 5878 |
나의라임토마토
|
13년 전 | 1407 | |
| 5877 | 13년 전 | 16769 | ||
| 5876 |
maniAc
|
13년 전 | 2804 | |
| 5875 | 13년 전 | 1039 | ||
| 5874 | 13년 전 | 3735 | ||
| 5873 |
lainfox
|
13년 전 | 1182 | |
| 5872 | 13년 전 | 1345 | ||
| 5871 | 13년 전 | 795 | ||
| 5870 | 13년 전 | 2529 | ||
| 5869 |
AMDbest
|
13년 전 | 1512 | |
| 5868 |
한번잘해보자
|
13년 전 | 657 | |
| 5867 |
|
13년 전 | 916 | |
| 5866 | 13년 전 | 7492 | ||
| 5865 | 13년 전 | 2408 | ||
| 5864 | 13년 전 | 937 | ||
| 5863 | 13년 전 | 1308 | ||
| 5862 | 13년 전 | 2876 | ||
| 5861 | 13년 전 | 1028 | ||
| 5860 | 13년 전 | 19330 | ||
| 5859 | 13년 전 | 2943 | ||
| 5858 | 13년 전 | 2651 | ||
| 5857 | 13년 전 | 4823 | ||
| 5856 |
|
13년 전 | 1951 | |
| 5855 | 13년 전 | 816 | ||
| 5854 | 13년 전 | 1007 | ||
| 5853 | 13년 전 | 16106 | ||
| 5852 | 13년 전 | 824 | ||
| 5851 | 13년 전 | 2222 | ||
| 5850 | 13년 전 | 1773 | ||
| 5849 |
AMDbest
|
13년 전 | 1305 | |
| 5848 |
|
13년 전 | 1164 | |
| 5847 |
SeanLee
|
13년 전 | 1304 | |
| 5846 | 13년 전 | 23465 | ||
| 5845 | 13년 전 | 2651 | ||
| 5844 | 13년 전 | 28806 | ||
| 5843 |
|
13년 전 | 2207 | |
| 5842 | 13년 전 | 22518 | ||
| 5841 | 13년 전 | 5743 | ||
| 5840 |
Quincy
|
13년 전 | 933 | |
| 5839 | 13년 전 | 963 | ||
| 5838 | 13년 전 | 2820 | ||
| 5837 | 13년 전 | 1094 | ||
| 5836 | 13년 전 | 2313 | ||
| 5835 | 13년 전 | 1519 | ||
| 5834 | 13년 전 | 1501 | ||
| 5833 | 13년 전 | 6676 | ||
| 5832 | 13년 전 | 5213 | ||
| 5831 | 13년 전 | 1071 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기