自己写的flash广告免激活JS代码

来源:互联网 发布:linux 网闸 单向 编辑:程序博客网 时间:2024/04/29 10:43
    通常做网站都需要用到flash,但现在的flash广告由于安全原因,微软要求必须激活才能使用,使网页界面上的flash在鼠标移上去的时候,多了个虚线框,不利于网站界面美观。由此,自己写了以下简单的javascript代码,免除激活之恼。


保存文件 flashplayer.js


// JavaScript Document

var path=null;

var width=null;

var height=null;

function flash(path,width,height)

{

    this.path=path;

    this.width=width;

    this.height=height;

    var str=null;

    str="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='"+this.width+"' height='"+this.height+"'>"
    str=+"<param name='movie' value='"+this.path+"' />"
    str=+"<param name='quality' value='high' />"
    str=+"<param name='wmode' value='transparent'>"
    str=+"<embed src='"+this.path+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+this.width+"' height='"+this.height+"'>"
    str=+"</embed>"
    str=+"</object>"

    document.write(str);

}


调用页面加入如下代码

<script type="text/javascript" src="flash.js">

<!--调用flash播放函数,第一个参数为flash地址,第二个,第三个分别为宽、高-->
flash("../flash/222222222-1.swf",300,400);


</script>
原创粉丝点击