%
strSQL="Select * From web_popwin where pw_open"
rs.open strSQL,conn,1,1
while not rs.eof%>
<%if rs("pw_style")=0 then
'弹出窗口
if session("popclick0")="" then session("popclick0")=0
session("popclick0")=session("popclick0")+1
if rs("pw_click")=0 or (rs("pw_click")>0 and rs("pw_click")>=session("popclick0")) then
strTitle=replace(trim(rs("pw_title")),"'","\'")
strContent=replace(trim(rs("pw_content")),"'","\'")
strContent=replace(strContent,chr(13) & chr(10),"")
strTitle="
" & strTitle & ""
strContent=strTitle & "" & strContent & ""
response.Write("var popwin=window.open('','popwin"&rs("id")&"','width=" & rs("pw_width") & ",height=" & rs("pw_height") & ",top=" & rs("pw_top") & ",left=" & rs("pw_left") & "');")
response.Write("popwin.document.write('" & strContent & "');")
end if
elseif rs("pw_style")=1 then
'浮动窗口'%>
document.write("px; POSITION: absolute; WIDTH: <%=rs("pw_width")%>px\"><%=replace(replace(replace(replace(rs("pw_content"),"/","\/"),"""","\"""),"'","\'"),VBcrlf," ")%>
");
var xPos = 20;
var yPos = document.body.clientHeight;
var step = 1;
var delay = 30;
var height = 0;
var Hoffset = 0;
var Woffset = 0;
var yon = 0;
var xon = 0;
var pause = true;
var interval;
img.style.top = yPos;
function changePos() {
width = document.body.clientWidth;
height = document.body.clientHeight;
Hoffset = img.offsetHeight;
Woffset = img.offsetWidth;
img.style.left = xPos + document.body.scrollLeft;
img.style.top = yPos + document.body.scrollTop;
if (yon) {
yPos = yPos + step;
}
else {
yPos = yPos - step;
}
if (yPos < 0) {
yon = 1;
yPos = 0;
}
if (yPos >= (height - Hoffset)) {
yon = 0;
yPos = (height - Hoffset);
}
if (xon) {
xPos = xPos + step;
}
else {
xPos = xPos - step;
}
if (xPos < 0) {
xon = 1;
xPos = 0;
}
if (xPos >= (width - Woffset)) {
xon = 0;
xPos = (width - Woffset);
}
}
function start() {
img.visibility = "visible";
interval = setInterval('changePos()', delay);
}
start();
<%elseif rs("pw_style")=2 then
'右下角浮出
if session("popclick2")="" then session("popclick2")=0
session("popclick2")=session("popclick2")+1
if rs("pw_click")=0 or (rs("pw_click")>0 and rs("pw_click")>=session("popclick2")) then%>
var oPopup = window.createPopup();
var timeID =10;
var hh=<%=rs("pw_height")%>
var gogo,gogo1,gogo2;
function ButtonClick(){
var oPopBody = oPopup.document.body;
var windstr="<%=replace(replace(replace(replace(rs("pw_content"),"/","\/"),"""","\"""),"'","\'"),VBcrlf," ")%>";
var winstr="";
oPopBody.innerHTML = winstr;
oPopup.show(screen.width,screen.height-timeID-28, <%=rs("pw_width")%>,timeID);
if (timeID<<%=rs("pw_height")%>)
{
timeID = timeID + 10;
gogo = setTimeout("ButtonClick()",30)
}
else
ss = setTimeout("piao()",30);
}
function piao(){
oPopup.show(screen.width,screen.height-hh-28,<%=rs("pw_width")%>,hh);
ss = setTimeout("piao()",30);
}
function pophide(){
oPopup.show(screen.width,screen.height-hh-28, <%=rs("pw_width")%>,hh);
clearTimeout(gogo);
clearTimeout(ss);
clearTimeout(cl);
if (hh>1)
{
hh = hh - 10;
gogo2 = setTimeout("pophide()",30)
}
else{
oPopup.hide()
clearTimeout(gogo2)
}
}
cl=setTimeout("pophide()",30000)
onload=ButtonClick
<%end if
elseif rs("pw_style")=3 then
'左侧浮动
%>
document.write("px; top: <%=trim(rs("pw_top"))%>px;width: <%=trim(rs("pw_width"))%>;height:<%=rs("pw_height")%>;position: absolute;visibility: visible;z-index: 10; \" align=\"center\"><%=replace(replace(replace(replace(rs("pw_content"),"/","\/"),"""","\"""),"'","\'"),VBcrlf," ")%>
");
self.onError=null;
currentX = currentY = 0;
whichIt = null;
lastScrollX = 0; lastScrollY = 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;
function heartBeat() {
if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }
if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }
if(diffY != lastScrollY) {
percent = .1 * (diffY - lastScrollY);
if(percent > 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) document.all.floater.style.pixelTop += percent;
if(NS) document.floater.top += percent;
lastScrollY = lastScrollY + percent;
}
if(diffX != lastScrollX) {
percent = .1 * (diffX - lastScrollX);
if(percent > 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) document.all.floater.style.pixelLeft += percent;
if(NS) document.floater.left += percent;
lastScrollX = lastScrollX + percent;
}
}
function checkFocus(x,y) {
stalkerx = document.floater.pageX;
stalkery = document.floater.pageY;
stalkerwidth = document.floater.clip.width;
stalkerheight = document.floater.clip.height;
if( (x > stalkerx && x < (stalkerx+stalkerwidth)) && (y > stalkery && y < (stalkery+stalkerheight))) return true;
else return false;
}
function grabIt(e) {
if(IE) {
whichIt = event.srcElement;
while (whichIt.id.indexOf("floater") == -1) {
whichIt = whichIt.parentElement;
if (whichIt == null) { return true; }
}
whichIt.style.pixelLeft = whichIt.offsetLeft;
whichIt.style.pixelTop = whichIt.offsetTop;
currentX = (event.clientX + document.body.scrollLeft);
currentY = (event.clientY + document.body.scrollTop);
} else {
window.captureEvents(Event.MOUSEMOVE);
if(checkFocus (e.pageX,e.pageY)) {
whichIt = document.floater;
StalkerTouchedX = e.pageX-document.floater.pageX;
StalkerTouchedY = e.pageY-document.floater.pageY;
}
}
return true;
}
function moveIt(e) {
if (whichIt == null) { return false; }
if(IE) {
newX = (event.clientX + document.body.scrollLeft);
newY = (event.clientY + document.body.scrollTop);
distanceX = (newX - currentX); distanceY = (newY - currentY);
currentX = newX; currentY = newY;
whichIt.style.pixelLeft += distanceX;
whichIt.style.pixelTop += distanceY;
if(whichIt.style.pixelTop < document.body.scrollTop) whichIt.style.pixelTop = document.body.scrollTop;
if(whichIt.style.pixelLeft < document.body.scrollLeft) whichIt.style.pixelLeft = document.body.scrollLeft;
if(whichIt.style.pixelLeft > document.body.offsetWidth - document.body.scrollLeft - whichIt.style.pixelWidth - 20) whichIt.style.pixelLeft = document.body.offsetWidth - whichIt.style.pixelWidth - 20;
if(whichIt.style.pixelTop > document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5) whichIt.style.pixelTop = document.body.offsetHeight + document.body.scrollTop - whichIt.style.pixelHeight - 5;
event.returnValue = false;
} else {
whichIt.moveTo(e.pageX-StalkerTouchedX,e.pageY-StalkerTouchedY);
if(whichIt.left < 0+self.pageXOffset) whichIt.left = 0+self.pageXOffset;
if(whichIt.top < 0+self.pageYOffset) whichIt.top = 0+self.pageYOffset;
if( (whichIt.left + whichIt.clip.width) >= (window.innerWidth+self.pageXOffset-17)) whichIt.left = ((window.innerWidth+self.pageXOffset)-whichIt.clip.width)-17;
if( (whichIt.top + whichIt.clip.height) >= (window.innerHeight+self.pageYOffset-17)) whichIt.top = ((window.innerHeight+self.pageYOffset)-whichIt.clip.height)-17;
return false;
}
return false;
}
function dropIt() {
whichIt = null;
if(NS) window.releaseEvents (Event.MOUSEMOVE);
return true;
}
if(NS) {
window.captureEvents(Event.MOUSEUP|Event.MOUSEDOWN);
window.onmousedown = grabIt;
window.onmousemove = moveIt;
window.onmouseup = dropIt;
}
if(IE) {
document.onmousedown = grabIt;
document.onmousemove = moveIt;
document.onmouseup = dropIt;
}
if(NS || IE) action = window.setInterval("heartBeat()",1);
<%elseif rs("pw_style")=4 then
'对联式%>
var delta=0.15
var collection;
function floaters() {
this.items = [];
this.addItem = function(id,x,y,content)
{
document.write('px; height:<%=trim(rs("pw_height"))%>px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+'
');
var newItem = {};
newItem.object = document.getElementById(id);
newItem.x = x;
newItem.y = y;
this.items[this.items.length] = newItem;
}
this.play = function()
{
collection = this.items
setInterval('play()',10);
}
}
function play()
{
if(screen.width<=800)
{
for(var i=0;i0?1:-1)*Math.ceil(Math.abs(dx));
followObj.style.left=followObj.offsetLeft+dx;
}
if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) {
var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;
dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
followObj.style.top=followObj.offsetTop+dy;
}
followObj.style.display = '';
}
}
var theFloaters = new floaters();
theFloaters.addItem('followDiv1','document.body.clientWidth-<%=trim(rs("pw_width"))%>-<%=trim(rs("pw_left"))%>',<%=trim(rs("pw_top"))%>,'<%=replace(replace(replace(replace(rs("pw_content"),"/","\/"),"""","\"""),"'","\'"),VBcrlf," ")%>');
theFloaters.addItem('followDiv2',<%=trim(rs("pw_left"))%>,<%=trim(rs("pw_top"))%>,'<%=replace(replace(replace(replace(rs("pw_content"),"/","\/"),"""","\"""),"'","\'"),VBcrlf," ")%>');
theFloaters.play();
<%end if
rs.movenext
wend
rs.close
set rs=nothing
conn.close
set conn=nothing%>