본문 바로가기
웹프로그램

자바스크립트 레이어를 이용한 팝업

by 세이박스 2008. 11. 7.
반응형

document.write('<div id="tmLayer" style="position:absolute; left:150px; top:50px; z-index:1; visibility: hidden;">');
document.write('<body topmargin=0 leftmargin=0>');

document.write('<table width="350" border="0" cellspacing="0" cellpadding="0">');
document.write(' <tr><td><img src="images/popup/top.gif" width="350" height="162"></td></tr>');
document.write(' <tr>');
document.write(' <td height="284" background="images/popup/cen.gif">');

document.write(' <table width="350" height="284" border="0" cellpadding="0" cellspacing="0">');
document.write(' <tr>');
document.write(' <td width="32">&nbsp;</td>');
document.write(' <td width="286" valign="top">');

document.write(' <table width="286" border="0" cellspacing="0" cellpadding="0">');
document.write(' <tr><td height="20"><?=$row_pop[subject]?></td></tr>');
document.write(' <tr><td height="5"></td></tr>');
document.write(' <tr><td height="1" bgcolor="#CCCCCC"></td></tr>');
document.write(' <tr><td height="8" valign="top"></td></tr>');
document.write(' <tr><td height="250" valign="top"><?=$row_pop[content]?></td></tr>');
document.write(' </table>');

document.write(' </td>');
document.write(' <td width="32">&nbsp;</td>');
document.write(' </tr>');
document.write(' </table>');

document.write(' </td>');
document.write(' </tr>');
document.write(' <tr>');
document.write(' <td height="54" valign="top" background="images/popup/end.gif">');

document.write(' <table width="350" height="0" border="0" cellpadding="0" cellspacing="0">');
document.write(' <tr><td height="21" colspan="3">&nbsp;</td></tr>');
document.write(' <tr>');
document.write(' <td width="29" height="33" align="right"><input type="checkbox" name="checkbox" value="checkbox" onClick="wondowclose(\'2\')"></td>');
document.write(' <td width="247">&nbsp;</td>');
document.write(' <td width="74"><img src="images/popup/btn.gif" width="59" height="20" border=0 onClick="wondowclose(\'3\')"></td>');
document.write(' </tr>');
document.write(' </table>');

document.write(' </td>');
document.write(' </tr>');
document.write('</table>');

document.write('</div>');

var pID = "event";
var strReturn = GetCookie(pID);
//alert(strReturn);
if ( strReturn == "" || strReturn == null || strReturn == "0" ) {
MM_showHideLayers("tmLayer","","show");
}

function wondowclose(kkk){
//SetCookie(pID, "2");
SetCookie(pID, kkk);
MM_showHideLayers("tmLayer","","hide");
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
obj.visibility=v; }
}

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 SetCookie(sName, sValue)
{
var expDays = 1; // 쿠키 만료기간(일수)
var todayDate = new Date();
var cookiePath = "/";
todayDate.setDate(todayDate.getDate() + expDays);

if (sValue == "1") {
document.cookie = sName + "=" + escape(sValue);
} else if (sValue == "2") {
document.cookie = sName + "=" + escape(sValue) + ";" +
"expires=" + todayDate.toGMTString() + ";" +
"path=" + cookiePath + ";"
}
}

반응형