| | |
| |
| 讯时CMS版本实现图片无细缝向上滚动 |
|
[ 2009/10/16 14:12:00 | By: 梦翔儿 ] |
以下是代码 ------------------
<!--#i nclude file = admin_conn.asp --> <!--#i nclude file = admin/titleb.asp --> <% sp=trim(Request("sp")) if sp="" then sp=1200 he=trim(Request("he")) if he="" then he=18 n=trim(Request("n")) if n="" then n=30 n=int(n) lm=trim(Request("lm")) if lm="" then lm=0 open=trim(request("open")) if open="1" then open="_blank" else open="_top" end if fontsize=trim(Request("fontsize")) if fontsize="" then fontsize="10" 'path="news_view.asp" path=config("path") sql="select top 10 * from [news] where title<>'' and sh=1" if lm<>"0" then sql=sql&" and (lm='"&lm&"' or lm2='"&lm&"' or lm3='"&lm&"') " sql=sql&" order by ontop desc , updat desc, id desc" Set rs = Server.CreateObject("ADODB.RecordSet") rs.Open sql,conn,1,1 if rs.recordcount=0 then Response.Write "<BR><center>No content!</center>" rs.close:set rs=nothing conn.close:set conn=nothing Response.end end if for i=1 to rs.recordcount title1=titleb(rs("title"),n) title1a=rs("title") id1=rs("id") rs.movenext if rs.eof then exit for
title2=titleb(rs("title"),n) title2a=rs("title") id2=rs("id") rs.movenext if rs.eof then exit for
title3=titleb(rs("title"),n) title3a=rs("title") id3=rs("id") rs.movenext if rs.eof then exit for
title4=titleb(rs("title"),n) title4a=rs("title") id4=rs("id") rs.movenext if rs.eof then exit for
title5=titleb(rs("title"),n) title5a=rs("title") id5=rs("id") rs.movenext if rs.eof then exit for title6=titleb(rs("title"),n) title6a=rs("title") id6=rs("id") rs.movenext if rs.eof then exit for title7=titleb(rs("title"),n) title7a=rs("title") id7=rs("id") rs.movenext if rs.eof then exit for title8=titleb(rs("title"),n) title8a=rs("title") id8=rs("id") rs.movenext if rs.eof then exit for title9=titleb(rs("title"),n) title9a=rs("title") id9=rs("id") rs.movenext if rs.eof then exit for title10=titleb(rs("title"),n) title10a=rs("title") id10=rs("id") rs.movenext if rs.eof then exit for
next rs.close set rs=nothing %> var marqueeContent=new Array(); //滚动新闻 //marqueeContent[0]='<a style="FONT-SIZE:<%=fontsize%>pt" title=<%=title1a%><%=hit%> href="/blog/<";%=path%>?NewsID=<%=id1%> target=<%=open%>><%=title1%></a> <a style="FONT-SIZE:<%=fontsize%>pt" title=<%=title2a%> href="/blog/<";%=path%>?NewsID=<%=id2%> target=<%=open%>><%=title2%></a> <a style="FONT-SIZE:<%=fontsize%>pt" title=<%=title3a%> href="/blog/<";%=path%>?NewsID=<%=id3%> target=<%=open%>><%=title3%></a> <a style="FONT-SIZE:<%=fontsize%>pt" title=<%=title4a%> href="/blog/<";%=path%>?NewsID=<%=id4%> target=<%=open%>><%=title4%></a> <a style="FONT-SIZE:<%=fontsize%>pt" title=<%=title5a%> href="/blog/<";%=path%>?NewsID=<%=id5%> target=<%=open%>><%=title5%></a><br>'; marqueeContent[0]='<a style="FONT-SIZE:<%=fontsize%>pt" title=<%=title1a%><%=hit%> href="/blog/<";%=fun_html_url(/blog/id1)%> target=<%=open%>><%=title1%></a> <a style="FONT-SIZE:<%=fontsize%>pt" title=<%=title2a%> href="/blog/<";%=fun_html_url(/blog/id2)%> target=<%=open%>><%=title2%></a> <a style="FONT-SIZE:<%=fontsize%>pt" title=<%=title3a%> href="/blog/<";%=fun_html_url(/blog/id3)%> target=<%=open%>><%=title3%></a> <a style="FONT-SIZE:<%=fontsize%>pt" title=<%=title4a%> href="/blog/<";%=fun_html_url(/blog/id4)%> target=<%=open%>><%=title4%></a> <a style="FONT-SIZE:<%=fontsize%>pt" title=<%=title5a%> href="/blog/<";%=fun_html_url(/blog/id5)%> target=<%=open%>><%=title5%></a><br>'; //marqueeContent[1]='<a style="FONT-SIZE:<%=fontsize%>pt" title=<%=title6a%> href="/blog/<";%=path%>?newsid=<%=id6%> target=<%=open%>><%=title6%></a> <a style="FONT-SIZE:<%=fontsize%>pt" title=<%=title7a%> href="/blog/<";%=path%>?newsid=<%=id7%> target=<%=open%>><%=title7%></a> <a style="FONT-SIZE:<%=fontsize%>pt" title=<%=title8a%> href="/blog/<";%=path%>?newsid=<%=id8%> target=<%=open%>><%=title8%></a> <a style="FONT-SIZE:<%=fontsize%>pt" title=<%=title9a%> href="/blog/<";%=path%>?newsid=<%=id9%> target=<%=open%>><%=title9%></a> <a style="FONT-SIZE:<%=fontsize%>pt" title=<%=title10a%> href="/blog/<";%=path%>?newsid=<%=id10%> target=<%=open%>><%=title10%></a><br>'; marqueeContent[1]='<a style="FONT-SIZE:<%=fontsize%>pt" title=<%=title6a%> href="/blog/<";%=fun_html_url(/blog/id6)%> target=<%=open%>><%=title6%></a> <a style="FONT-SIZE:<%=fontsize%>pt" title=<%=title7a%> href="/blog/<";%=fun_html_url(/blog/id7)%> target=<%=open%>><%=title7%></a> <a style="FONT-SIZE:<%=fontsize%>pt" title=<%=title8a%> href="/blog/<";%=fun_html_url(/blog/id8)%> target=<%=open%>><%=title8%></a> <a style="FONT-SIZE:<%=fontsize%>pt" title=<%=title9a%> href="/blog/<";%=fun_html_url(/blog/id9)%> target=<%=open%>><%=title9%></a> <a style="FONT-SIZE:<%=fontsize%>pt" title=<%=title10a%> href="/blog/<";%=fun_html_url(/blog/id10)%> target=<%=open%>><%=title10%></a><br>';
var marqueeInterval=new Array(); //定义一些常用而且要经常用到的变量 var marqueeId=0; var marqueeDelay=<%=sp%>; var marqueeHeight=<%=he%>;
//接下来的是定义一些要使用到的函数 function initMarquee() { var str=marqueeContent[0]; document.write('<div id=marqueeBox style="overflow:hidden;height:'+marqueeHeight+'px"><div>'+str+'</div></div>'); marqueeId++; marqueeInterval[0]=setInterval("startMarquee()",marqueeDelay); } function startMarquee() { var str=marqueeContent[marqueeId]; marqueeId++; if(marqueeId>=marqueeContent.length) marqueeId=0; if(marqueeBox.childNodes.length==1) { var nextLine=document.createElement('DIV'); nextLine.innerHTML=str; marqueeBox.appendChild(nextLine); } else { marqueeBox.childNodes[0].innerHTML=str; marqueeBox.appendChild(marqueeBox.childNodes[0]); marqueeBox.scrollTop=0; } clearInterval(marqueeInterval[1]); marqueeInterval[1]=setInterval("scrollMarquee()",25); } function scrollMarquee() { marqueeBox.scrollTop++; if(marqueeBox.scrollTop%marqueeHeight==(marqueeHeight-1)){ clearInterval(marqueeInterval[1]); } } initMarquee();
------------------------------------------------------------------- 将代码存为js_news_textroll.asp,放到系统目录下。
调用代码
<iframe src="/web/picscroll_up.asp?lm=85&picw=92&pich=125&width=630&height=150&picx=6&n=10&pictitlecolor=ff00e0" width="630" height="150" marginwidth="0" marginheight="0" align="center" scrolling="No" frameborder="0" hspace="0" vspace="0" border="0" framespacing="0"></iframe>
lm 栏目名 picw 图片宽 pich图片高 picx横排显示的图片数 n图片标题字数 width=" " height=" " 这个是框架的大小 |
|
| | | |