当前位置: 首页 > 图文教程 > 网络编程 > Javascript > 比较简单的一个符合web标准的JS调用flash方法

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 比较简单的一个符合web标准的JS调用flash方法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 95 ::
收藏到网摘: n/a

微软XP升级出现的bug,就是对于使用传统网页制作模式插入页面的flash无法正常浏览,页面打开的时候flash周围是一个虚线框,需要点击一下才能正常浏览,以下的办法就是解决这一缺点,并且让flash能符合WEB标准,此外最重要的是,整个网站的所有flash都可以调用这一段代码,让你的代码更加简洁!

1.先建立一个flash.js的JS文件,并写入
复制代码 代码如下:

function flash(ur,w,h){
document.write('<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="'+w+'" height="'+h+'">');
document.write('<param name="movie" value="'+ur+'">');
document.write('<param name="quality" value="high"> ');
document.write('<param name="wmode" value="transparent"> ');
document.write('<param name="menu" value="false"> ');
document.write('<embed src="'+ur+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="'+w+'" height="'+h+'" quality="High" wmode="transparent">');
document.write('</embed>');
document.write('</object>');
}

2.在网页里<head>与</head>之间写入调用JS的代码:
复制代码 代码如下:

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

3.然后在网页主体内容里写入调用flash的代码(只要是flash都可以调用):
复制代码 代码如下:

<script language="javascript" type="text/javascript">flash('images/01.swf','529','600');</script>
<script language="javascript" type="text/javascript">flash('images/02.swf','529','600');</script>
<script language="javascript" type="text/javascript">flash('images/03.swf','529','600');</script>