最近刚刚到公司,写得这个东西,放在这里收藏一下,方便以后用。
<script type="text/javascript" language="javascript">
<%=divID%>marqueesHeightone=300;
<%=divID%>stopscroll1=false;
with(<%=divID%>){
style.width=380;
style.height=<%=divID%>marqueesHeightone;
style.overflowX="visible";
style.overflowY="hidden";
noWrap=true;
onmouseover=new Function("<%=divID%>stopscroll1=true");
onmouseout=new Function("<%=divID%>stopscroll1=false");
}
<%=divID%>preTop1=0; <%=divID%>currentTop1=<%=divID%>marqueesHeightone; <%=divID%>stoptime1=0;
<%=divID%>.innerHTML+=<%=divID%>.innerHTML;
function init_<%=divID%>srolltext1(){
<%=divID%>.scrollTop=0;
setInterval("<%=divID%>scrollUp1()",1);
}init_<%=divID%>srolltext1();
function <%=divID%>scrollUp1(){
if(<%=divID%>stopscroll1==true) return;
<%=divID%>currentTop1+=1;
if(<%=divID%>currentTop1==<%=divID%>marqueesHeightone+1)
{
<%=divID%>stoptime1+=1;
<%=divID%>currentTop1-=1;
if(<%=divID%>stoptime1==500)
{
<%=divID%>currentTop1=0;
<%=divID%>stoptime1=0;
}
}
else {
<%=divID%>preTop1=<%=divID%>.scrollTop;
<%=divID%>.scrollTop+=1;
if(<%=divID%>preTop1==<%=divID%>.scrollTop){
<%=divID%>.scrollTop=<%=divID%>marqueesHeightone;
<%=divID%>.scrollTop+=1;
}
}
}
init_<%=divID%>srolltext1();
</script>