새창으로 팝업 띠우기 > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

새창으로 팝업 띠우기 정보

새창으로 팝업 띠우기

본문

새창으로 팝업을 하나 띠우려고 하는데 이걸 브라우져 접속할때만 딱 한번 나오게 하고 싶습니다.

혹시 이 부분에 대해서 아시는 분 있나요?

댓글 전체

set_session()이나 set_cookie()로 오늘 창을 띄웠다고 기록하는 건 어떨까요?

간단하게 이렇게 해도 될 것 같아요.
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>
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT