스크립트
< 자료공유 < 스크립트
스크립트자료실

자동팝업 띄우기

페이지 정보

작성일13-02-06 14:07 조회1,671회

본문

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<title>팝업 자동으로 뜨기</title>
<script language="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 "";
}
function openCookieWin() {
if (getCookie("ncook") != "done") {
noticeWindow = window.open("new.html","","width=400, height=330, top=200,left=100");
noticeWindow.opener = self;
}
}
//-->
</script>
</head>
<body onLoad="openCookieWin()">

</body>
</html>
</head>
 
팝업 소스
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<title>팝업</title>
<head>
<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.checkClose.ncook.checked == true) {
setCookie("ncook", "done" ,7);
}
self.close();
}
//-->
</script>
</head>
<body style="margin:0;padding:0;background-color:#000000;">
<center> <form name="checkClose">
<table cellpadding="0" cellspacing="0">
  <tr>
    <Td colspan="2">
      <img src="http://madalla.kr/script/img/a1.jpg" width="400" height="300">
    </td>
   </tr>
  <tr>
   <Td style="font-size:11px;color:#ffffff; background-color:#000;text-align:center;width:90%;">
      <input type="checkbox" name="ncook">다음부터 이 창을 띄우지 않음
  </td>
  <td style="font-size:11px;color:#ffffff;text-align:right;background-color:#000;width:10%;font-weight:bold;">
       <a href="#" onClick="closeWin()">닫기</a>&nbsp;&nbsp;
   </td>
  </tr> </form>
</table>
</body>
</html>
  • 페이스북으로 보내기
  • 트위터로 보내기
  • 구글플러스로 보내기