您的位置:首页 > 编程语言

flash图片轮换广告代码详解

2007-11-20 21:34 309 查看
var alimama_pid="mm_10474132_546401_835202";
var alimama_titlecolor="0000FF";
var alimama_descolor ="000000";
var alimama_bgcolor="FFFFFF";
var alimama_bordercolor="E6E6E6";
var alimama_linkcolor="008000";
var alimama_bottomcolor="FFFFFF";
var alimama_anglesize="0";
var alimama_bgpic="0";
var alimama_icon="0";
var alimama_sizecode="12";
var alimama_width=468;
var alimama_height=60;
var alimama_type=2;

以下是本人在实际建站过程中用到的asp带数据库的flash的图片轮换广告,非常实用!

下面将实现步骤详述如下,希望能给大家带来帮助!

首先建立一个数据表,tbl_news,主要字段有id,title,picurl,content,istop,orderid等等

<SCRIPT type=text/javascript>

<!--

//格式初始化

var focus_width = 240;//大小可以随意改变

var focus_height = 170;

var text_height = 18;

var swf_height = focus_height + text_height;

//获得相关图片

<%

'读取数据库,这里的8可以根据需要更改,istop是推荐字段,可以控制显示的内容,orderid是排序字段!

sql="select top 8 * from tbl_news where istop1=1 order by orderid desc"

set rsnews=conn.execute(sql)

m=0

'循环写入变量

do while not rsnews.eof

picurl="upload/images/"&rsnews("picurl")

title=cutstr(rsnews("title"),30)

if m=0 then '只有一条记录时

pics=picurl

links=server.UrlEncode("newsinfo.asp?id="&rsnews("id"))

texts=title

else '多条记录时

pics=picurl&"|"&pics

links=server.UrlEncode("newsinfo.asp?id="&rsnews("id")&"|"&links

texts=title&"|"&texts

end if

m=m+1

rsnews.movenext

loop

%>

'下面的images/player.swf,填写正确的地址就可以使用了

var pics = "<%=pics%>";

var links = "<%=links%>";

var texts = "<%=texts%>";

//输出调用代码

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="images/player.swf"><param name="quality" value="high"><param name="bgcolor" value="#E3E3E3">');

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="images/player.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#E3E3E3" 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>

player.swf
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: