ClassicASP 레이어 팝업
페이지 정보
본문
Classic ASP 를 이용해서 레이어로 뜨는 팝업을 만들때 사용합니다.
2개 이상의 팝업도 사용할수 있습니다.
디비 팝업 테이블 필드
Cookie_Name : 팝업 고유변수
Top_Locate : 좌측 상단 위치
Left_Locate : 좌측 왼쪽 위치
W_Scale : 팝업창 넓이
H_Scale : 팝업창 높이 ( 하루안뜨기 제외한 높이값 )
<!-- POPUP -->
<script type="text/javascript">
function setCookie( name, value, expiredays ) {
var todayDate = new Date();
todayDate.setDate( todayDate.getDate() + expiredays );
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
</script>
<%
' POPUP 시작
dim hp_PopupLayer, hp_PopupLayer_top, hp_PopupLayer_left, hp_PopupLayer_width, hp_PopupLayer_height
'dim rs_popup
set rs_popup=server.CreateObject ("ADODB.RecordSet")
'sql = "select count(idx) from "&DBLeft&"_Popup where P_Type = 'D' and UseTF='1' and SDate <= '2021-08-11' and EDate >='2021-08-11'"
sql_popup = "select * from "& DBLeft &"_Popup where P_Type = 'D' and UseTF='1' and SDate <= '"& date &"' and EDate >='"& date &"'"
rs_popup.open sql_popup,db,1
if rs_popup.bof or rs_popup.eof then
else
do until rs_popup.eof
' 반복 시작
hp_PopupLayer = rs_popup("Cookie_Name") ' 팝업 고유변수
hp_PopupLayer_top = rs_popup("Top_Locate") ' 좌측 상단 위치
hp_PopupLayer_left = rs_popup("Left_Locate") ' 좌측 왼쪽 위치
hp_PopupLayer_width = rs_popup("W_Scale") ' 팝업창 넓이
hp_PopupLayer_height = rs_popup("H_Scale") ' 팝업창 높이 ( 하루안뜨기 제외한 높이값 )
%>
<script>
function closeWin<% response.write hp_PopupLayer %>() {
if ( document.popForm<% response.write hp_PopupLayer %>.chkbox.checked ){
setCookie( "popCookie<% response.write hp_PopupLayer %>", "done" , 1 );
}
document.all['popDiv<% response.write hp_PopupLayer %>'].style.visibility = "hidden";
}
</script>
<div style="position:relative; z-index:1000; left:0px; top:0px;">
<div id="popDiv<% response.write hp_PopupLayer %>" style="border:1px solid #4E4E4E; position:absolute; width:<% response.write hp_PopupLayer_width %>px; height:<% response.write hp_PopupLayer_height %>px; z-index:1; left:<% response.write hp_PopupLayer_left %>px; top:<% response.write hp_PopupLayer_top %>px; visibility:hidden;">
<div>
<% response.write rs_popup("Contents") %>
</div>
<div style="font-size:12px; background-color:#000000; color:#ffffff; text-align:right; height:25px; line-height:25px; ">
<form name="popForm<% response.write hp_PopupLayer %>" style="padding:0; margin:0;">
<input type="checkbox" name="chkbox" value="checkbox"> 오늘 하루 이 창을 열지 않음
<a href="javascript:closeWin<% response.write hp_PopupLayer %>();" style="text-decoration: none; color:#ffffff"><strong>[닫기]</strong></a>
</form>
</div>
</div>
</div>
<script type="text/javascript">
cookiedata = document.cookie;
if ( cookiedata.indexOf("popCookie<% response.write hp_PopupLayer %>=done") < 0 ) {
document.all['popDiv<% response.write hp_PopupLayer %>'].style.visibility = "visible";
} else {
document.all['popDiv<% response.write hp_PopupLayer %>'].style.visibility = "hidden";
}
</script>
<%
' 반복 끝
rs_popup.movenext
loop
end if
rs_popup.close
'db2.close
' POPUP 끝
%>
<!-- //POPUP -->
2개 이상의 팝업도 사용할수 있습니다.
디비 팝업 테이블 필드
Cookie_Name : 팝업 고유변수
Top_Locate : 좌측 상단 위치
Left_Locate : 좌측 왼쪽 위치
W_Scale : 팝업창 넓이
H_Scale : 팝업창 높이 ( 하루안뜨기 제외한 높이값 )
<!-- POPUP -->
<script type="text/javascript">
function setCookie( name, value, expiredays ) {
var todayDate = new Date();
todayDate.setDate( todayDate.getDate() + expiredays );
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
</script>
<%
' POPUP 시작
dim hp_PopupLayer, hp_PopupLayer_top, hp_PopupLayer_left, hp_PopupLayer_width, hp_PopupLayer_height
'dim rs_popup
set rs_popup=server.CreateObject ("ADODB.RecordSet")
'sql = "select count(idx) from "&DBLeft&"_Popup where P_Type = 'D' and UseTF='1' and SDate <= '2021-08-11' and EDate >='2021-08-11'"
sql_popup = "select * from "& DBLeft &"_Popup where P_Type = 'D' and UseTF='1' and SDate <= '"& date &"' and EDate >='"& date &"'"
rs_popup.open sql_popup,db,1
if rs_popup.bof or rs_popup.eof then
else
do until rs_popup.eof
' 반복 시작
hp_PopupLayer = rs_popup("Cookie_Name") ' 팝업 고유변수
hp_PopupLayer_top = rs_popup("Top_Locate") ' 좌측 상단 위치
hp_PopupLayer_left = rs_popup("Left_Locate") ' 좌측 왼쪽 위치
hp_PopupLayer_width = rs_popup("W_Scale") ' 팝업창 넓이
hp_PopupLayer_height = rs_popup("H_Scale") ' 팝업창 높이 ( 하루안뜨기 제외한 높이값 )
%>
<script>
function closeWin<% response.write hp_PopupLayer %>() {
if ( document.popForm<% response.write hp_PopupLayer %>.chkbox.checked ){
setCookie( "popCookie<% response.write hp_PopupLayer %>", "done" , 1 );
}
document.all['popDiv<% response.write hp_PopupLayer %>'].style.visibility = "hidden";
}
</script>
<div style="position:relative; z-index:1000; left:0px; top:0px;">
<div id="popDiv<% response.write hp_PopupLayer %>" style="border:1px solid #4E4E4E; position:absolute; width:<% response.write hp_PopupLayer_width %>px; height:<% response.write hp_PopupLayer_height %>px; z-index:1; left:<% response.write hp_PopupLayer_left %>px; top:<% response.write hp_PopupLayer_top %>px; visibility:hidden;">
<div>
<% response.write rs_popup("Contents") %>
</div>
<div style="font-size:12px; background-color:#000000; color:#ffffff; text-align:right; height:25px; line-height:25px; ">
<form name="popForm<% response.write hp_PopupLayer %>" style="padding:0; margin:0;">
<input type="checkbox" name="chkbox" value="checkbox"> 오늘 하루 이 창을 열지 않음
<a href="javascript:closeWin<% response.write hp_PopupLayer %>();" style="text-decoration: none; color:#ffffff"><strong>[닫기]</strong></a>
</form>
</div>
</div>
</div>
<script type="text/javascript">
cookiedata = document.cookie;
if ( cookiedata.indexOf("popCookie<% response.write hp_PopupLayer %>=done") < 0 ) {
document.all['popDiv<% response.write hp_PopupLayer %>'].style.visibility = "visible";
} else {
document.all['popDiv<% response.write hp_PopupLayer %>'].style.visibility = "hidden";
}
</script>
<%
' 반복 끝
rs_popup.movenext
loop
end if
rs_popup.close
'db2.close
' POPUP 끝
%>
<!-- //POPUP -->
댓글목록
등록된 댓글이 없습니다.