본문 바로가기

새 창 오늘 하루만 띄우기

by 애덤더미 2014. 7. 21.
반응형

- 띄워지는 새 창에 들어가는 내용 (파일명 : pop.htm) 

  

<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.forms[0].Notice.checked ) 


                setCookie( "Notice", "done" , 1); 

        self.close(); 

// --> 
</SCRIPT> 

.....내용이 들어가고.. 

<form><input type="checkbox" name="Notice" value="">오늘 창 그만보기<a href="#" onClick="javascript:history.onclick=closeWin()">[닫기]</a></form> 

 

 

 

 

- 새 창을 띄워주는 원본파일의 내용 (파일명 : index.htm) 

  

<SCRIPT LANGUAGE="JavaScript"> 
<!-- 
function change(form) 

if (form.url.selectedIndex !=0) 
parent.location = form.url.options[form.url.selectedIndex].value 

function setCookie( name, value, expiredays ) 

        var todayDate = new Date(); 
        todayDate.setDate( todayDate.getDate() + expiredays ); 
        document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" 

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('pop.htm','notice','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=568,height=291'); 
        noticeWindow.opener = self; 

// --> 
</SCRIPT> 

반응형