目前很多网站都使用FLASH轮换广告,看起来十分漂亮,偶研究了一下发现有一个很不错的办法,并且可自由控制FLASH轮换广告的尺寸,效果如下所示:
使用代码如下:
代码
<
TABLE
height
=400
cellSpacing
=0
cellPadding
=0
width
=400
border
=0
>
< TBODY >
< TR >
< TD >
< SCRIPT language =JavaScript type =text/javascript >
<!--
var focus_width = 386
var focus_height = 386
var text_height = 14
var swf_height = focus_height + text_height
var pics = ' ad1.jpg|ad2.jpg|ad3.jpg|ad4.jpg|ad5.jpg '
var links = ' http://www.seobug.cn|http://www.seobug.cn|http://www.seobug.cn|http://www.seobug.cn|http://www.seobug.cn '
var texts = ' 广告1|广告2 |广告3|广告4|广告4 '
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=picflash.swf><param name=quality value=high><param name=bgcolor value=#DADADA> ' );
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=picflash.swf wmode=opaque FlashVars="pics= ' + pics + ' &links= ' + links + ' &texts= ' + texts + ' &borderwidth= ' + focus_width + ' &borderheight= ' + focus_height + ' &textheight= ' + text_height + ' " menu=false bgcolor=#DADADA quality=high width=" ' + focus_width + ' " height=" ' + swf_height + ' " allowScriptAccess=sameDomain type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer /> ' );
document.write( ' </object> ' );
// -->
</ SCRIPT >
</ TD ></ TR ></ TBODY ></ TABLE >
< TBODY >
< TR >
< TD >
< SCRIPT language =JavaScript type =text/javascript >
<!--
var focus_width = 386
var focus_height = 386
var text_height = 14
var swf_height = focus_height + text_height
var pics = ' ad1.jpg|ad2.jpg|ad3.jpg|ad4.jpg|ad5.jpg '
var links = ' http://www.seobug.cn|http://www.seobug.cn|http://www.seobug.cn|http://www.seobug.cn|http://www.seobug.cn '
var texts = ' 广告1|广告2 |广告3|广告4|广告4 '
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=picflash.swf><param name=quality value=high><param name=bgcolor value=#DADADA> ' );
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=picflash.swf wmode=opaque FlashVars="pics= ' + pics + ' &links= ' + links + ' &texts= ' + texts + ' &borderwidth= ' + focus_width + ' &borderheight= ' + focus_height + ' &textheight= ' + text_height + ' " menu=false bgcolor=#DADADA quality=high width=" ' + focus_width + ' " height=" ' + swf_height + ' " allowScriptAccess=sameDomain type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer /> ' );
document.write( ' </object> ' );
// -->
</ SCRIPT >
</ TD ></ TR ></ TBODY ></ TABLE >
代码使用方法:请直接将代码部分copy至广告位的自定义内容中。
修改方法:
代码:
height=320 为广告总高度(修改数字即可)width=24 为广告总宽度 (修改数字即可)
var focus_width=400 图片宽度(修改数字即可)
var focus_height=400图片高度(修改数字即可)
var text_height=25 底部文字所在区域的高度pics为图片地址:可自行修改图片地址,注意5个地址间的“|”。如需要增加或减少图片,请直接增减!links为图片链接网址:注意顺序的对应,用“|”间隔。
texts为相对应的广告的文字,用“|”间隔。
picflash.swf 为整个轮换广告所调用的FLASH文件。可修改所在地址。(此文件已上传至/Files/Sangplus/picflash.swf)
请解压后直接上传至网站根目录。如需要修改地址请勿必记得修改代码中picflash.swf 的地址!