📄 function.asp
字号:
}
if(aname.indexOf("Netscape")!=-1)
{if(aver>=4) brOK=navigator.javaEnabled();}
}
var vmin=2;
var vmax=5;
var vr=2;
var timer1;
function Chip(chipname,width,height)
{this.named=chipname;
this.vx=vmin+vmax*Math.random();
this.vy=vmin+vmax*Math.random();
this.w=width;
this.h=height;
this.xx=0;
this.yy=0;
this.timer1=null;
}
function movechip(chipname)
{
if(brOK && mystop==0)
{eval("chip="+chipname);
if(!mie)
{pageX=window.pageXOffset;
pageW=window.innerWidth;
pageY=window.pageYOffset;
pageH=window.innerHeight;
}
else
{pageX=window.document.body.scrollLeft;
pageW=window.document.body.offsetWidth-8;
pageY=window.document.body.scrollTop;
pageH=window.document.body.offsetHeight;
}
chip.xx=chip.xx+chip.vx;
chip.yy=chip.yy+chip.vy;
chip.vx+=vr*(Math.random()-0.5);
chip.vy+=vr*(Math.random()-0.5);
if(chip.vx>(vmax+vmin)) chip.vx=(vmax+vmin)*2-chip.vx;
if(chip.vx<(-vmax-vmin)) chip.vx=(-vmax-vmin)*2-chip.vx;
if(chip.vy>(vmax+vmin)) chip.vy=(vmax+vmin)*2-chip.vy;
if(chip.vy<(-vmax-vmin)) chip.vy=(-vmax-vmin)*2-chip.vy;
if(chip.xx<=pageX)
{chip.xx=pageX;
chip.vx=vmin+vmax*Math.random();
}
if(chip.xx>=pageX+pageW-chip.w)
{chip.xx=pageX+pageW-chip.w;
chip.vx=-vmin-vmax*Math.random();
}
if(chip.yy<=pageY)
{chip.yy=pageY;
chip.vy=vmin+vmax*Math.random();
}
if(chip.yy>=pageY+pageH-chip.h)
{chip.yy=pageY+pageH-chip.h;
chip.vy=-vmin-vmax*Math.random();
}
if(!mie)
{eval('document.'+chip.named+'.top ='+chip.yy);
eval('document.'+chip.named+'.left='+chip.xx);
}
else
{eval('document.all.'+chip.named+'.style.pixelLeft='+chip.xx);
eval('document.all.'+chip.named+'.style.pixelTop ='+chip.yy);
}
chip.timer1=setTimeout("movechip('"+chip.named+"')",100);
}
}
function stopme(x)
{
brOk=true;
mystop=x;
movechip("FlAD");
}
var FlAD;
var chip;
function FlAD()
{checkbrOK();
FlAD=new Chip("FlAD",80,80);
if(brOK)
{ movechip("FlAD");
}
}
ns4=(document.layers)?true:false;
ie4=(document.all)?true:false;
function cncover()
{
if(ns4){
//document.cnc.left=window.innerWidth/2-400;
document.FlAD.visibility="hide";
eval('document.cnc.left=document.'+chip.named+'.left');
eval('document.cnc.top=document.'+chip.named+'.top-15');
document.cnc.visibility="show";
}else if(ie4)
{
document.all.FlAD.style.visibility="hidden";
//document.all.cnc.style.left=window.document.body.offsetWidth/2-400;
document.all.cnc.style.left=parseInt(document.all.FlAD.style.left)-0;
document.all.cnc.style.top=parseInt(document.all.FlAD.style.top)-0;
document.all.cnc.style.visibility="visible";
stopme(1);
}
}
function cncout()
{
if(ns4){
document.cnc.visibility="hide";
document.FlAD.visibility="show";
}else if(ie4)
{
document.all.cnc.style.visibility="hidden";
document.all.FlAD.style.visibility="visible";
stopme(0);
}
}
</script>
<%
end sub
'==================================================
'过程名:FixedAD
'作 用:固定位置广告
'参 数:无
'==================================================
sub FixedAD()
%>
<script LANGUAGE="JavaScript">
function initEcAd() {
document.all.AdLayer1.style.posTop = -200;
document.all.AdLayer1.style.visibility = 'visible'
document.all.AdLayer2.style.posTop = -200;
document.all.AdLayer2.style.visibility = 'visible'
MoveLeftLayer('AdLayer1');
MoveRightLayer('AdLayer2');
}
function MoveLeftLayer(layerName) {
var x = 2;
var y = 240;
var diff = (document.body.scrollTop + y - document.all.AdLayer1.style.posTop)*.10;
var y = document.body.scrollTop + y - diff;
eval("document.all." + layerName + ".style.posTop = parseInt(y)");
eval("document.all." + layerName + ".style.posLeft = x");
setTimeout("MoveLeftLayer('AdLayer1');", 50);
}
function MoveRightLayer(layerName) {
var x = 2;
var y = 240;
var diff = (document.body.scrollTop + y - document.all.AdLayer2.style.posTop)*.10;
var y = document.body.scrollTop + y - diff;
eval("document.all." + layerName + ".style.posTop = y");
eval("document.all." + layerName + ".style.posRight = x");
setTimeout("MoveRightLayer('AdLayer2');", 50);
}
initEcAd()
</script>
<%
end sub
'==================================================
'过程名:FixedAD1
'作 用:固定位置广告(图片位置超过窗口时卷动时有问题)
'参 数:无
'==================================================
sub FixedAD1()
%>
<script LANGUAGE="JavaScript">
<!-- Begin
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.FixAD.style.pixelTop += percent;
if(NS) document.FixAD.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.FixAD.style.pixelLeft += percent;
if(NS) document.FixAD.left += percent;
lastScrollX = lastScrollX + percent;
}
}
function checkFocus(x,y) {
stalkerx = document.FixAD.pageX;
stalkery = document.FixAD.pageY;
stalkerwidth = document.FixAD.clip.width;
stalkerheight = document.FixAD.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("FixAD") == -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.FixAD;
StalkerTouchedX = e.pageX-document.FixAD.pageX;
StalkerTouchedY = e.pageY-document.FixAD.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);
// End -->
</script>
<%
end sub
%>
<%
Function ProductClass(ClassID)
Dim rs,sql,i,ChildCount,FolderType,FolderName,onMouseUp,ListType
Set rs=server.CreateObject("adodb.recordset")
sql="Select * From 0791idc_ProductClass where ParentID="&ClassID&" order by ClassID"
rs.open sql,conn,1,1
if ClassID=0 and rs.recordcount=0 then
response.write ("暂无分类!")
response.end
end if
i=1
response.write("<table border='0' cellspacing='0' cellpadding='0'>")
while not rs.eof
ChildCount=conn.execute("select count(*) from 0791idc_ProductClass where ParentID="&rs("ClassID"))(0)
if ChildCount=0 then
if i=rs.recordcount then
FolderType="SortFileEnd"
else
FolderType="SortFile"
end if
FolderName=rs("ClassName")
onMouseUp=""
else
if i=rs.recordcount then
FolderType="SortFolderOpen"
ListType="SortListline"
onMouseUp="EndSortChange('a"&rs("ClassID")&"','b"&rs("ClassID")&"');"
else
FolderType="SortEndFolderOpen"
ListType="SortListline"
onMouseUp="SortChange('a"&rs("ClassID")&"','b"&rs("ClassID")&"');"
end if
FolderName=rs("ClassName")
end if
response.write("<tr>")
response.write("<td nowrap id='b"&rs("ClassID")&"' class='"&FolderType&"' onMouseUp="&onMouseUp&"></td><td nowrap><a href='Product.asp?ClassID="&rs("ClassID")&"&title="&rs("ClassName")&"'>"&FolderName&"")
response.write("</td></tr>")
if ChildCount>0 then
%>
<tr id="a<%= rs("ClassID")%>" style="display:none"><td class="<%= ListType%>" nowrap></td><td ><% ProductClass(rs("ClassID")) %></td></tr>
<%
end if
rs.movenext
i=i+1
wend
response.write("</table>")
rs.close
set rs=nothing
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -