새창으로 팝업 띠우기 정보
새창으로 팝업 띠우기본문
새창으로 팝업을 하나 띠우려고 하는데 이걸 브라우져 접속할때만 딱 한번 나오게 하고 싶습니다.
혹시 이 부분에 대해서 아시는 분 있나요?
혹시 이 부분에 대해서 아시는 분 있나요?
댓글 전체

set_session()이나 set_cookie()로 오늘 창을 띄웠다고 기록하는 건 어떨까요?
간단하게 이렇게 해도 될 것 같아요.
if($_SESSION[popup_date] == $g4[time_ymd]) {
창 띄우는 코드
$_SESSION[popup_date] = $g4[time_ymd];
}
간단하게 이렇게 해도 될 것 같아요.
if($_SESSION[popup_date] == $g4[time_ymd]) {
창 띄우는 코드
$_SESSION[popup_date] = $g4[time_ymd];
}

부모 html에 들어가는 소스입니다.
<script type="text/javascript">
<!--
function getCookie( name ){
var nameOfCookie = name + "=";
var x = 0;
while ( x <= document.cookie.length )
{
var y = (x+nameOfCookie.length);
if ( document.cookie.substring( x, y ) == nameOfCookie ) {
if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
endOfCookie = document.cookie.length;
return unescape( document.cookie.substring( y, endOfCookie ) );
}
x = document.cookie.indexOf( " ", x ) + 1;
if ( x == 0 )
break;
}
return "";
}
//폼의 체크 박스를 체그 하면 새창이 나타나지 않으며, 체크 하지 않았을 경우, 계속 나타납니다.
if ( getCookie( "Notice" ) != "done" ) {
//새창으로 열릴 페이지의 경로 및 크기와 위치를 지정해 주세요.
noticeWindow = window.open('../popup/pop.html','notice','left=0, top=0, width=450,height=341');
noticeWindow.opener = self;
}
// -->
</script>
그리고 팝업 소스입니다.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script type="text/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.pop.Notice.checked )
setCookie( "Notice", "done" , 1);//1은 하루동안 새창을 열지 않게 합니다.
window.close();
}
// -->
</script>
</head>
<body>
<form name="pop">
<table width="446" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><img src="../img/main/pop01.gif" width="450" height="311"></td>
</tr>
<tr>
<td height="30" align=right bgcolor="#792606">
<input type="checkbox"name="Notice" value="" checked style="display:none">
<!--<font color="#ffffff">하루동안 이창을 열지 않음</font>--><a href="javascript:closeWin();">
[닫기]</a></td>
</tr>
</table>
</form>
</body>
</html>
<script type="text/javascript">
<!--
function getCookie( name ){
var nameOfCookie = name + "=";
var x = 0;
while ( x <= document.cookie.length )
{
var y = (x+nameOfCookie.length);
if ( document.cookie.substring( x, y ) == nameOfCookie ) {
if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
endOfCookie = document.cookie.length;
return unescape( document.cookie.substring( y, endOfCookie ) );
}
x = document.cookie.indexOf( " ", x ) + 1;
if ( x == 0 )
break;
}
return "";
}
//폼의 체크 박스를 체그 하면 새창이 나타나지 않으며, 체크 하지 않았을 경우, 계속 나타납니다.
if ( getCookie( "Notice" ) != "done" ) {
//새창으로 열릴 페이지의 경로 및 크기와 위치를 지정해 주세요.
noticeWindow = window.open('../popup/pop.html','notice','left=0, top=0, width=450,height=341');
noticeWindow.opener = self;
}
// -->
</script>
그리고 팝업 소스입니다.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script type="text/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.pop.Notice.checked )
setCookie( "Notice", "done" , 1);//1은 하루동안 새창을 열지 않게 합니다.
window.close();
}
// -->
</script>
</head>
<body>
<form name="pop">
<table width="446" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><img src="../img/main/pop01.gif" width="450" height="311"></td>
</tr>
<tr>
<td height="30" align=right bgcolor="#792606">
<input type="checkbox"name="Notice" value="" checked style="display:none">
<!--<font color="#ffffff">하루동안 이창을 열지 않음</font>--><a href="javascript:closeWin();">
[닫기]</a></td>
</tr>
</table>
</form>
</body>
</html>
제가 개 가라로 배워서 초보수준 이라 ㅋㅋㅋ
참고해서 해 볼꼐요 ㅋㅋㅋ
참고해서 해 볼꼐요 ㅋㅋㅋ