热门javascript图片文字向上滚动.docx
- 文档编号:30689707
- 上传时间:2023-08-19
- 格式:DOCX
- 页数:17
- 大小:17.80KB
热门javascript图片文字向上滚动.docx
《热门javascript图片文字向上滚动.docx》由会员分享,可在线阅读,更多相关《热门javascript图片文字向上滚动.docx(17页珍藏版)》请在冰豆网上搜索。
热门javascript图片文字向上滚动
functionMarquee()
{
this.ID=document.getElementById(arguments[0]);
if(!
this.ID)
{
alert("aaa"+arguments[0]+"bbbb!
");
this.ID=-1;
return;
}
this.Direction=this.Width=this.Height=this.DelayTime=this.WaitTime=this.CTL=this.StartID=this.Stop=this.MouseOver=0;
this.Step=1;
this.Timer=30;
this.DirectionArray={"top":
0,"up":
0,"bottom":
1,"down":
1,"left":
2,"right":
3};
if(typeofarguments[1]=="number"||typeofarguments[1]=="string")this.Direction=arguments[1];
if(typeofarguments[2]=="number")this.Step=arguments[2];
if(typeofarguments[3]=="number")this.Width=arguments[3];
if(typeofarguments[4]=="number")this.Height=arguments[4];
if(typeofarguments[5]=="number")this.Timer=arguments[5];
if(typeofarguments[6]=="number")this.DelayTime=arguments[6];
if(typeofarguments[7]=="number")this.WaitTime=arguments[7];
if(typeofarguments[8]=="number")this.ScrollStep=arguments[8];
this.ID.style.overflow=this.ID.style.overflowX=this.ID.style.overflowY="hidden";
this.ID.noWrap=true;
this.IsNotOpera=(navigator.userAgent.toLowerCase().indexOf("opera")==-1);
if(arguments.length>=7)this.Start();
}
Marquee.prototype.Start=function()
{
if(this.ID==-1)return;
if(this.WaitTime<800)this.WaitTime=800;
if(this.Timer<20)this.Timer=20;
if(this.Width==0)this.Width=parseInt(this.ID.style.width);
if(this.Height==0)this.Height=parseInt(this.ID.style.height);
if(typeofthis.Direction=="string")this.Direction=this.DirectionArray[this.Direction.toString().toLowerCase()];
this.HalfWidth=Math.round(this.Width/2);
this.HalfHeight=Math.round(this.Height/2);
this.BakStep=this.Step;
this.ID.style.width=this.Width+"px";
this.ID.style.height=this.Height+"px";
if(typeofthis.ScrollStep!
="number")this.ScrollStep=this.Direction>1?
this.Width:
this.Height;
vartemplateLeft=" collapse;display: inline;'> nowrap;word-break: keep-all;'>MSCLASS_TEMP_HTML nowrap;word-break: keep-all;'>MSCLASS_TEMP_HTML ";
vartemplateTop=" collapse;'>MSCLASS_TEMP_HTML ";MSCLASS_TEMP_HTML
varmsobj=this;
msobj.tempHTML=msobj.ID.innerHTML;
if(msobj.Direction<=1)
{
msobj.ID.innerHTML=templateTop.replace(/MSCLASS_TEMP_HTML/g,msobj.ID.innerHTML);
}
else
{
if(msobj.ScrollStep==0&&msobj.DelayTime==0)
{
msobj.ID.innerHTML+=msobj.ID.innerHTML;
}
else
{
msobj.ID.innerHTML=templateLeft.replace(/MSCLASS_TEMP_HTML/g,msobj.ID.innerHTML);
}
}
vartimer=this.Timer;
vardelaytime=this.DelayTime;
varwaittime=this.WaitTime;
msobj.StartID=function(){msobj.Scroll()}
msobj.Continue=function()
{
if(msobj.MouseOver==1)
{
setTimeout(msobj.Continue,delaytime);
}
else
{clearInterval(msobj.TimerID);
msobj.CTL=msobj.Stop=0;
msobj.TimerID=setInterval(msobj.StartID,timer);
}
}
msobj.Pause=function()
{
msobj.Stop=1;
clearInterval(msobj.TimerID);
setTimeout(msobj.Continue,delaytime);
}
msobj.Begin=function()
{
msobj.ClientScroll=msobj.Direction>1?
msobj.ID.scrollWidth/2:
msobj.ID.scrollHeight/2;
if((msobj.Direction<=1&&msobj.ClientScroll<=msobj.Height+msobj.Step)||(msobj.Direction>1&&msobj.ClientScroll<=msobj.Width+msobj.Step)){
msobj.ID.innerHTML=msobj.tempHTML;
delete(msobj.tempHTML);
return;
}
delete(msobj.tempHTML);
msobj.TimerID=setInterval(msobj.StartID,timer);
if(msobj.ScrollStep<0)return;
msobj.ID.onmousemove=function(event)
{
if(msobj.ScrollStep==0&&msobj.Direction>1)
{
varevent=event||window.event;
if(window.event)
{
if(msobj.IsNotOpera)
{
msobj.EventLeft=event.srcElement.id==msobj.ID.id?
event.offsetX-msobj.ID.scrollLeft:
event.srcElement.offsetLeft-msobj.ID.scrollLeft+event.offsetX;
}
else
{
msobj.ScrollStep=null;
return;
}
}
else
{
msobj.EventLeft=event.layerX-msobj.ID.scrollLeft;
}
msobj.Direction=msobj.EventLeft>msobj.HalfWidth?
3:
2;
msobj.AbsCenter=Math.abs(msobj.HalfWidth-msobj.EventLeft);
msobj.Step=Math.round(msobj.AbsCenter*(msobj.BakStep*2)/msobj.HalfWidth);
}
}
msobj.ID.onmouseover=function()
{
if(msobj.ScrollStep==0)return;
msobj.MouseOver=1;
clearInterval(msobj.TimerID);
}
msobj.ID.onmouseout=function()
{
if(msobj.ScrollStep==0)
{
if(msobj.Step==0)msobj.Step=1;
return;
}
msobj.MouseOver=0;
if(msobj.Stop==0)
{
clearInterval(msobj.TimerID);
msobj.TimerID=setInterval(msobj.StartID,timer);
}
}
}
setTimeout(msobj.Begin,waittime);
}
Marquee.prototype.Scroll=function()
{
switch(this.Direction)
{
case0:
this.CTL+=this.Step;
if(this.CTL>=this.ScrollStep&&this.DelayTime>0)
{
this.ID.scrollTop+=this.ScrollStep+this.Step-this.CTL;
this.Pause();
return;
}
else
{
if(this.ID.scrollTop>=this.ClientScroll)
{
this.ID.scrollTop-=this.ClientScroll;
}
this.ID.scrollTop+=this.Step;
}
break;
case1:
this.CTL+=this.Step;
if(this.CTL>=this.ScrollStep&&this.DelayTime>0)
{
this.ID.scrollTop-=this.ScrollStep+this.Step-this.CTL;
this.Pause();
return;
}
else
{
if(this.ID.scrollTop<=0)
{
this.ID.scrollTop+=this.ClientScroll;
}
this.ID.scrollTop-=this.Step;
}
break;
case2:
this.CTL+=this.Step;
if(this.CTL>=this.ScrollStep&&this.DelayTime>0)
{
this.ID.scrollLeft+=this.ScrollStep+this.Step-this.CTL;
this.Pause();
return;
}
else
{
if(this.ID.scrollLeft>=this.ClientScroll)
{
this.ID.scrollLeft-=this.ClientScroll;
}
this.ID.scrollLeft+=this.Step;
}
break;
case3:
this.CTL+=this.Step;
if(this.CTL>=this.ScrollStep&&this.DelayTime>0)
{
this.ID.scrollLeft-=this.ScrollStep+this.Step-this.CTL;
this.Pause();
return;
}
else
{
if(this.ID.scrollLeft<=0)
{
this.ID.scrollLeft+=this.ClientScroll;
}
this.ID.scrollLeft-=this.Step;
}
break;
}
}
//-->
@charset"utf-8";
/*CSSDocument*/
body,h1,h2,h3,h4,h5,h6,p,ul,ol,li,form,img,dl,dt,dd,table,th,td,blockquote,fieldset,div,strong,label,em{margin:
0;padding:
0;border:
0;}
ul,ol,li{list-style:
none;}
input,button{margin:
0;font-size:
12px;vertical-align:
middle;}
body{font-size:
12px;font-family:
Arial,Helvetica,sans-serif;text-align:
center;margin:
0auto;}
table{border-collapse:
collapse;border-spacing:
0;}
a{color:
#333;text-decoration:
none;}
a:
hover{text-decoration:
none;color:
#c00;}
.area5a{width:
950px;margin:
20pxauto;}
.top01-hot{background:
url(../images/d1-bg04.gif)no-repeat;padding-left:
166px;width:
784px;float:
left;height:
37px;overflow:
hidden;}
.part01-hot{width:
623px;float:
left;padding-top:
5px;display:
inline;text-align:
center;}
.part01-hota{margin:
06px;color:
#fff;}
.part02-hot{float:
right;padding-right:
11px;width:
150px;padding-top:
10px;text-align:
right;}
.part02-hota{color:
#36c;}
.part02-hota.more{padding-left:
4px;margin-left:
5px;background:
url(../images/line03.gif)no-repeatleft0;}
.mid01-hot{background:
url(../images/d1-bg05.gif)repeat-y;width:
100%;height:
176px;overflow:
hidden;float:
left;}
.shopPH{MARGIN-TOP:
10px;POSITION:
relative;HEIGHT:
217px}
.bd{padding-left:
15px;}
.bdLI{float:
left;width:
298px;padding-top:
8px;height:
72px;_display:
inline}
.bdLI.pic{FLOAT:
left;WIDTH:
153px;TEXT-ALIGN:
left}
.bdLI.picimg{border:
#e2e2e21pxsolid;padding:
3px;display:
block;width:
135px;height:
60px;}
.bdLI.info{float:
left;width:
145px;text-align:
left;}
.bdLI.infoh3{padding-top:
2px;height:
19px;overflow:
hidden;}
.bdLI.infoh3a{font-size:
12px;font-weight:
normal;color:
#36c;}
.bdLI.infop.star{color:
#888;height:
23px;}
.bdLI.infop.menua{display:
block;background:
url(../images/bg01.gif)no-repeat;width:
101px;height:
23px;text-align:
center;line-height:
23px;color:
#36c;}
.bdLI.infop.menua:
hover{color:
#f30;}
.bot01-hot{background:
url(../images/d1-bg06.gif)no-repeat;width:
100%;height:
5px;overflow:
hidden;float:
left;}
商家入驻