读书人

csdn首页的图片广告轮换是如何做的

发布时间: 2012-02-27 10:00:22 作者: rapoo

csdn首页的图片广告轮换是怎么做的?
csdn首页的图片广告轮换幻灯片(图片下面有1,2,3,4,5,6张图可以变换)是怎么做的?谁能提供代码?谢谢!

[解决办法]
我的blog里面有,呵呵,这里给一个例子
<!--
FLASH样式
本例可以设置TOP的数字,从而可以动态控制图象的数量
-->
<!--#include file= "inc/conn.asp "-->
<%Set rs=Server.CreateObject( "ADODB.Recordset ")
sql= "select top 5 * from product where elite=true order by updatetime desc "
rs.open sql,conn,1,1%>
<DIV style= "DISPLAY: none ">
<TABLE id=pictable cellSpacing=0 cellPadding=0 width= "100% " border=0>
<TBODY>
<%do while not rs.eof
%>
<TR>

<TD> <%=rs( "bookpic ")%> </TD>
<TD> <%=rs( "product_id ")%> </TD>
<TD> productshow.asp?articleid= <%=rs( "articleid ")%> </TD> </TR>
<%rs.movenext
Loop
rs.close%>
</TBODY> </TABLE> </DIV>
<SCRIPT type=text/javascript>
<!--

var focus_width=550;//图象的宽度
var focus_height=145;//图象的高度
var text_height=25;//文字高度
var swf_height = focus_height+text_height;
var t=document.getElementById( "pictable ");
var rl=t.rows.length;
var baseu= document.URL.replace(/(http.*\/)(.*)/, "$1 ");
var pics= " "; var links= " "; var texts= " ";
for (var i=0;i <rl;i++) {
pics+=baseu+t.rows[i].cells[0].innerText.replace(/\/.*\//, " ")+ "| ";
links+=t.rows[i].cells[2].innerText+ "| ";
texts+=t.rows[i].cells[1].innerText+ "| ";
}
pics=pics.substr(0,pics.length-1);
links=links.substr(0,links.length-1);
texts=texts.substr(0,texts.length-1);
var fv= "pics= "+pics+ "&links= "+links+ "&texts= "+texts+ "&borderwidth= "+focus_width+ "&borderheight= "+focus_height+ "&textheight= "+text_height;
document.write( ' <object classid= "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 " codebase= "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0 " width= " '+focus_width+ ' " height= " '+swf_height+ ' "> ');
document.write( ' <param name= "movie " value= "test/pv.swf "> <param name= "quality " value= "high "> <param name= "allowScriptAccess " value= "sameDomain "> <param name= "menu " value= "false "> <param name= "bgcolor " value= "#ffffff "> <param name= "wmode " value= "opaque "> ');
document.write( ' <param name= "flashvars " value= " '+fv+ ' "> </object> ');


//-->
</SCRIPT>


[解决办法]
<script type= "text/javascript ">
imgUrl1= "images/youyn1.jpg ";
imgtext1= "云南海外旅游总公司 "
imgLink1=escape( "http://www.youyn.net/us.asp ");
imgUrl2= " images/youyn2.jpg ";
imgtext2= "精彩云南旅游 "
imgLink2=escape( "http://www.youyn.net/travelline.asp?un_type=1 ");
imgUrl3= " images/youyn3.jpg ";
imgtext3= "中国 魅力无限 "
imgLink3=escape( "http://www.youyn.net/travelline.asp?un_type=2 ");
imgUrl4= " images/youyn4.jpg ";
imgtext4= "海外带你游世界 "
imgLink4=escape( "http://www.youyn.net/travelline.asp?un_type=3 ");


imgUrl5= " images/youyn5.jpg ";
imgtext5= "云南会议接待服务 "
imgLink5=escape( "http://www.youyn.net/meeting.asp ");

var focus_width=298
var focus_height=90
var text_height=18
var swf_height = focus_height+text_height

var pics=imgUrl1+ "| "+imgUrl2+ "| "+imgUrl3+ "| "+imgUrl4+ "| "+imgUrl5
var links=imgLink1+ "| "+imgLink2+ "| "+imgLink3+ "| "+imgLink4+ "| "+imgLink5
var texts=imgtext1+ "| "+imgtext2+ "| "+imgtext3+ "| "+imgtext4+ "| "+imgtext5

document.write( ' <object classid= "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 " codebase= "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0 " width= " '+ focus_width + ' " height= " '+ swf_height + ' "> ');
document.write( ' <param name= "allowScriptAccess " value= "sameDomain "> <param name= "movie " value= "http://www.weci.cn/upload/news.swf "> <param name= "quality " value= "high "> <param name= "bgcolor " value= "#F0F0F0 "> ');
document.write( ' <param name= "menu " value= "false "> <param name=wmode value= "opaque "> ');
document.write( ' <param name= "FlashVars " value= "pics= '+pics+ '&links= '+links+ '&texts= '+texts+ '&borderwidth= '+focus_width+ '&borderheight= '+focus_height+ '&textheight= '+text_height+ ' "> ');
document.write( ' <embed src= "pixviewer.swf " wmode= "opaque " FlashVars= "pics= '+pics+ '&links= '+links+ '&texts= '+texts+ '&borderwidth= '+focus_width+ '&borderheight= '+focus_height+ '&textheight= '+text_height+ ' " menu= "false " bgcolor= "#F0F0F0 " quality= "high " width= " '+ focus_width + ' " height= " '+ focus_height + ' " allowScriptAccess= "sameDomain " type= "application/x-shockwave-flash " pluginspage= "http://www.macromedia.com/go/getflashplayer " /> '); document.write( ' </object> ');


</script>


效果请点击 www.youyn.net 查看

读书人网 >ASP

热点推荐