1. 부모창에서
<SCRIPT LANGUAGE="JavaScript">
<!--
function getCookie(name) {
var Found = false
var start, end
var i = 0
while(i <= document.cookie.length) {
start = i
end = start + name.length
if(document.cookie.substring(start, end) == name) {
Found = true
break
}
i++
}
if(Found == true) {
start = end + 1
end = document.cookie.indexOf(";", start)
if(end < start)
end = document.cookie.length
return document.cookie.substring(start, end)
}
return ""
}
function win_open(t_url) { //v2.0
var noticeCookie=getCookie("i_don_want"); //i_don_want: 쿠키이름
if (noticeCookie != "no")
window.open(t_url,'','width=570,height=880,left=0,top=0')
}
function win_open2(t_url) { //v2.0
window.open(t_url,'','width=800,height=580,left=0,top=0,scrollbars=yes,resizable=yes')
}
//-->
</SCRIPT>
<body onload="javascript:win_open('popup.html')">
2. popup 화일에서 ( 여기서는 popup.html )
<script language="JavaScript">
function setCookie( name, value, expiredays ) {
var todayDate = new Date();
todayDate.setDate( todayDate.getDate() + expiredays );
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
function closeWin() {
if ( document.cnjform.notice.checked ){
setCookie("i_don_want", "no" , 1); //i_don_want: 쿠키이름
self.close();
}
}
</script>
<form name="cnjform" style="margin:0px;padding:0px;">
<table border="0" width="567">
<tr>
<td width="567">
<p align="right">
<input type="checkbox" name="notice" onclick="closeWin();"><font size=2><b>하루에 한번만 보기</b></font>
</p>
<td>
</tr>
</table>
</form>
<SCRIPT LANGUAGE="JavaScript">
<!--
function getCookie(name) {
var Found = false
var start, end
var i = 0
while(i <= document.cookie.length) {
start = i
end = start + name.length
if(document.cookie.substring(start, end) == name) {
Found = true
break
}
i++
}
if(Found == true) {
start = end + 1
end = document.cookie.indexOf(";", start)
if(end < start)
end = document.cookie.length
return document.cookie.substring(start, end)
}
return ""
}
function win_open(t_url) { //v2.0
var noticeCookie=getCookie("i_don_want"); //i_don_want: 쿠키이름
if (noticeCookie != "no")
window.open(t_url,'','width=570,height=880,left=0,top=0')
}
function win_open2(t_url) { //v2.0
window.open(t_url,'','width=800,height=580,left=0,top=0,scrollbars=yes,resizable=yes')
}
//-->
</SCRIPT>
<body onload="javascript:win_open('popup.html')">
2. popup 화일에서 ( 여기서는 popup.html )
<script language="JavaScript">
function setCookie( name, value, expiredays ) {
var todayDate = new Date();
todayDate.setDate( todayDate.getDate() + expiredays );
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
function closeWin() {
if ( document.cnjform.notice.checked ){
setCookie("i_don_want", "no" , 1); //i_don_want: 쿠키이름
self.close();
}
}
</script>
<form name="cnjform" style="margin:0px;padding:0px;">
<table border="0" width="567">
<tr>
<td width="567">
<p align="right">
<input type="checkbox" name="notice" onclick="closeWin();"><font size=2><b>하루에 한번만 보기</b></font>
</p>
<td>
</tr>
</table>
</form>
'프로그래밍Tips' 카테고리의 다른 글
[명령어] tar 묶을 때 특정 디렉토리 또는 화일만 빼고 묶기 (1) | 2007.07.20 |
---|---|
자바 관련 사이트들입니다....이미지를 클릭하세요.. (0) | 2007.05.25 |
간단한 유닉스(리눅스) 명령어 (1) | 2007.03.20 |