首先在<head>区域,插入引用:
<script. src="ad/global.js" type="text/javascript"></script>
global.js 代码如下:
复制代码 代码如下:
function my_getbyid(id)
{
itm = null;
if (document.getElementById)
{
itm = document.getElementById(id);
}
else if (document.all)
{
itm = document.all[id];
}
else if (document.layers)
{
itm = document.layers[id];
}
return itm;
}
function sunad(element,url,width,height,images,links,texts)
{
if (!my_getbyid(element)) return;
var str = '';
str += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,9,0" width="'+ width +'" height="'+ height +'">';
str += '<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="'+url+'"><param name="quality" value="high"><param name="bgcolor" value="#ffffff">';
str += '<param name="menu" value="false"><param name=wmode value="opaque">';
str += '<param name="FlashVars" value="pics='+images+'&links='+links+'&texts='+texts+'&borderwidth='+width+'&borderheight='+height+'&textheight=0">';
str += '<embed src="'+url+'" wmode="opaque" FlashVars="pics='+images+'&links='+links+'&texts='+texts+'&borderwidth='+width+'&borderheight='+height+'&textheight=0" menu="false" bgcolor="#ffffff" quality="high" width="'+ width +'" height="'+ height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
str += '</object>';
my_getbyid(element).innerHTML = str;
}
如文件名为ad.asp,在幻灯片区域调用:<!--#include file="ad.asp" -->
复制代码 代码如下:
<div id="story_flash"> </div>
<a target=_self href="javascript.:goUrl()">
<script. type="text/javascript">
url_0="http://www.abc.com";
img_0="http://www.abc.com/01.jpg";
url_1="http://www.abc.com";
img_1="http://www.abc.com/02.jpg";
url_2="http://www.abc.com";
img_2="http://www.abc.com/03.jpg";
url_3="http://www.abc.com";
img_3="http://www.abc.com/04.jpg";
url_4="http://www.abc.com";
img_4="http://www.abc.com/05.jpg";
var focus_width=250
var focus_height=250
var text_height=0
var swf_height = focus_height+text_height
var pics =img_0+"|"+img_1+"|"+img_2+"|"+img_3+"|"+img_4
var links=url_0+"|"+url_1+"|"+url_2+"|"+url_3+"|"+url_4
var texts = '';
var focus = 'http://www.abc.com/ad/focus.swf';
sunad('story_flash',focus, focus_width,swf_height,pics,links,texts)
</script>
</a>
上面代码中:var focus = 'http://www.abc.com/ad/focus.swf';
这句的focus.swf是flash播放文件