微软由于种种原因,在sp2后限制了IE的ActiveX的使用模式,就是在页面中的ActiveX有一个虚框,需要用户点击一次才能正常交互。Flash是作为一个ActiveX嵌入到网页中的,所以它也会受牵连,只有通过JS嵌入Flash才能解决这个问题。没有Flash版本检测,如果版本浏览器的flash插件版本不够,或者不能正常显示你的swf文件,或者会弹出一个ActiveX的确认安装的框——这个框对很多用户来说是很恐怖的,网上找了半天,没有一个关于幻灯片广告代码,没办法,自己研究了,经过测试通过。
首先在<head>区域,插入引用:
<script.src="ad/global.js"type="text/javascript"></script>
global.js代码如下:
复制代码 代码如下:
functionmy_getbyid(id)
{
itm=null;
if(document.getElementById)
{
itm=document.getElementById(id);
}
elseif(document.all)
{
itm=document.all[id];
}
elseif(document.layers)
{
itm=document.layers[id];
}
returnitm;
}
functionsunad(element,url,width,height,images,links,texts)
{
if(!my_getbyid(element))return;
varstr='';
str+='<objectclassid="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+='<paramname="allowScriptAccess"value="sameDomain"><paramname="movie"value="'+url+'"><paramname="quality"value="high"><paramname="bgcolor"value="#ffffff">';
str+='<paramname="menu"value="false"><paramname=wmodevalue="opaque">';
str+='<paramname="FlashVars"value="pics='+images+'&links='+links+'&texts='+texts+'&borderwidth='+width+'&borderheight='+height+'&textheight=0">';
str+='<embedsrc="'+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:///ad/focus.swf';
这句的focus.swf是flash播放文件
