일반 팝업창을 다시 띄우지 않는 소스

황제낙엽 2005.07.16 08:12 조회 수 : 15 추천:155

sitelink1  
sitelink2  
sitelink3  
sitelink4  
extra_vars4  
extra_vars5  
extra_vars6  

팝업창을 띄울 페이지에 들어갈 소스
 

<html>

<head>

<title> 팝업창 다시띄우지 않는 스크립트 </title>

<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('popup.html', 'notice', 'toolbar=no,location=no,directories=no,status=no,menubar=no,

                    scrollbars=no,resizable=no,width=400,height=200,top=100,left=80');

            noticeWindow.opener = self;

        }

    // -->

</SCRIPT>

</head>

<body></body>

</html>

 





팝업창 문서에 들어갈 소스



 

<html>

<head>

<title> 팝업창 다시띄우지 않는 스크립트</title>

 

<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>

</head>

 

<body>

 <form>

   <input type = CHECKBOX name = "Notice" value = ""/> 다시 열지 않음

   <a href = "javascript:history.onclick=closeWin()"> 닫기 </a>

 </form>

</body>

</html>