[쇼핑몰] 다중 레이어 팝업창 > 팁앤테크

본문 바로가기

사이트 내 전체검색

뒤로가기 팁앤테크

[쇼핑몰] 다중 레이어 팝업창

본문

index.php 아래

<?
include "$g4[shop_path]/newwin1.inc.php"; // 새창띄우기

include_once("$g4[path]/tail.php");
?>

 

newwin1.inc.php의 내용

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

include_once("./_common.php");
?>

<script language="Javascript1.2">
<!--
isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

function ddInit(e){
 topDog=isIE ? "BODY" : "HTML";
 hotDog=isIE ? event.srcElement : e.target;
 idx=hotDog.id.substr(hotDog.id.length-1,1);
 whichDog=isIE ? eval("document.all.divpop"+idx) : document.getElementById("divpop" + idx);
 wD = eval("document.all.divpop"+idx);
 while (hotDog.id!=hotDog.id&&hotDog.tagName!=topDog){
   hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
 }

   //if (hotDog.id){
 if (hotDog.id==("titleBar"+idx)){
     offsetx=isIE ? event.clientX : e.clientX;
     offsety=isIE ? event.clientY : e.clientY;
     nowX=parseInt(whichDog.style.left);
     nowY=parseInt(whichDog.style.top);
     ddEnabled=true;
     document.onmousemove=dd;
   }
}

function dd(e){
 if (!ddEnabled) return;
 whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx;
 whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
 return false;
}

function ddN4(whatDog){
 if (!isN4) return;
 N4=eval(whatDog);
   N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
   N4.onmousedown=function(e){
     N4.captureEvents(Event.MOUSEMOVE);
     N4x=e.x;
     N4y=e.y;
  }
   N4.onmousemove=function(e){
  if (isHot){
        N4.moveBy(e.x-N4x,e.y-N4y);
        return false;
     }
   }
   N4.onmouseup=function(){
     N4.releaseEvents(Event.MOUSEMOVE);
   }
}

function hideMe(id){
 if ( document.getElementById('chkbox'+id).checked ) {
     setCookie( "mainPop"+id, "done" , 1 );
   document.getElementById('chkbox'+id).checked = false;
   }

   if (isIE||isNN) document.getElementById('divpop'+id).style.visibility="hidden";
   else if (isN4) document.divpop.visibility="hide";
}

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

document.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");
//-->
</script>

<style type="text/css">
<!--
td {
  font-family: Tahoma, 돋움, Dotum, sans-serif;
  font-size: 11px;
  line-height: 145%;
  color: #000000;
}
//-->
</style>

<?
$sql = " select * from $g4[yc4_new_win_table]
   where '$g4[time_ymdhis]' between nw_begin_time and nw_end_time
   order by nw_id asc ";
$result = sql_query($sql);
for ($i=0; $row_nw=sql_fetch_array($result); $i++) {

$j = $i + 1;
$row_nw[nw_subject] = get_text($row_nw[nw_subject]);
$row_nw[nw_content] = conv_content($row_nw[nw_content], 1);
?>

<div id="divpop<?=$i?>" style="position:absolute;width:<?=($row_nw[nw_width]+12)?>px;left:<?=$row_nw[nw_left]?>;top:<?=$row_nw[nw_top]?>;visibility:hidden;z-index:<?=$j?>">
<table border="0" width="<?=($row_nw[nw_width]+12)?>" bgcolor="#9f9f9f" cellspacing="0" cellpadding="1">
<tr><td width="100%">
 <table border="0" width="<?=($row_nw[nw_width]+10)?>" cellspacing="0" cellpadding="0" height="<?=($row_nw[nw_height]+50)?>">
    <tr height="20">
    <td width="<?=$row_nw[nw_width]?>" id="titleBar<?=$i?>" style="cursor:move">
    <ilayer width="100%" onSelectStart="return false">
    <layer width="100%" onMouseover="isHot=true;if (isN4) ddN4(divpop<?=$i?>)" onMouseout="isHot=false">
    <font face="Arial" color="#FFFFFF">&nbsp;<?=$row_nw[nw_subject]?></font>
    </layer>
    </ilayer>
    </td>
    <td width="10" style="cursor:hand" align="right" valign="top"><a href="#" onClick="hideMe(<?=$i?>);return false"><font color=#ffffff size=2 face=arial style="text-decoration:none">X</font></a>&nbsp;</td>
    </tr>
    <tr><td colspan="2" bgcolor="#FFFFFF" style="padding:5px" valign="top">
    <?=conv_content($row_nw[nw_content], $row_nw[nw_content_html]);?>
    </td></tr>
   <tr><td colspan="2" height="20" bgcolor="#EFEFEF" align="right">
   <input type="checkbox" name="chkbox<?=$i?>" id="chkbox<?=$i?>" value="checkbox" onfocus="this.blur();" onclick="hideMe(<?=$i?>);"> 하루 동안 이 창을 열지 않습니다. &nbsp;
   </td></tr>
    </table>
</td></tr>
</table>
</div>

<?
}
?>

<script language="Javascript">
<!--
cookiedata = document.cookie;
for (j=0;j<<?=$i?>;j++){
 if ( cookiedata.indexOf("mainPop"+j+"=done") < 0 ) {
     document.all['divpop'+j].style.visibility = "visible";
  }
  else {
   document.all['divpop'+j].style.visibility = "hidden";
  }
}
//-->
</script>

추천0

댓글목록 0

등록된 댓글이 없습니다.

전체 825건 24 페이지
게시물 검색
Copyright (c) 株式会社YHPLUS. All rights reserved.

사이트 정보

株式会社YHPLUS / 대표 : ZERO
〒171-0014 東京都豊島区池袋2-41-5 アーバン154 8F
050-5539-7787
오픈카카오톡 (YHPLUS) :
https://open.kakao.com/o/slfDj15d

PC 버전으로 보기