手机
当前位置:查字典教程网 >网页设计 > Div+Css教程 >flash幻灯片需要先激活ActiveX控件才能使用的又一个办法
flash幻灯片需要先激活ActiveX控件才能使用的又一个办法
摘要:微软由于种种原因,在sp2后限制了IE的ActiveX的使用模式,就是在页面中的ActiveX有一个虚框,需要用户点击一次才能正常交互。Fl...

微软由于种种原因,在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://www.macromedia.com/go/getflashplayer"/>';

str+='</object>';

my_getbyid(element).innerHTML=str;

}

在需要放置幻灯片的地方,用下面的代码覆盖,也可以把下面的代码单独写成一个文件调用,

如文件名为ad.asp,在幻灯片区域调用:<>

复制代码 代码如下:

<divid="story_flash"></div>

<atarget=_selfhref="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";

varfocus_width=250

varfocus_height=250

vartext_height=0

varswf_height=focus_height+text_height

varpics=img_0+"|"+img_1+"|"+img_2+"|"+img_3+"|"+img_4

varlinks=url_0+"|"+url_1+"|"+url_2+"|"+url_3+"|"+url_4

vartexts='';

varfocus='http://www.abc.com/ad/focus.swf';

sunad('story_flash',focus,focus_width,swf_height,pics,links,texts)

</script>

</a>

上面代码中:varfocus='http://www.abc.com/ad/focus.swf';

这句的focus.swf是flash播放文件

【flash幻灯片需要先激活ActiveX控件才能使用的又一个办法】相关文章:

CSS实现圆柱型数据报表的方法

CSS之DIV长度相等的几个办法

DIV点击折叠实例代码

css控制div不能居中的解决办法

CSS布局需要掌握的8个你技巧

仿网易div+css滑动门选项卡效果

根据用户浏览器及分辨率调用不同的CSS样式文件

SPAN和DIV的区别

CSS中的!important属性用法

2种方法实现CSS LI隔行换色

精品推荐
分类导航