脚本显示flash

本文介绍了一种在网页中嵌入Flash内容的方法,通过使用JavaScript脚本来实现Flash内容的动态加载,并提供了具体的代码实例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<!--
function WirteFlashBlock(strURL,nWidth,nHeight,strBkColor,strID,strAlignMode,strQuality,strFlashVars)
{
 var embedTxt;
 embedTxt = "<embed";
 if (strURL==null)
 {
  return;
 }
 embedTxt += ' src="'+strURL+'"';
 document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"');
 if (nHeight)
 {
  document.write(' height="'+nHeight+'"');
  embedTxt += ' height="'+nHeight+'"';
 }
 if (nWidth)
 {
  document.write(' width="'+nWidth+'"');
  embedTxt += ' width="'+nWidth+'"';
 }
 if (strID)
 { 
  document.write(' id="'+strID+'"');
  embedTxt += ' name="'+strID+'"';
 }
 if (strAlignMode)
 {
  document.write(' align="'+strAlignMode+'"');
  embedTxt += ' align="'+strAlignMode+'"';
 }
 
 document.write('>');
 document.writeln('<param name="menu" value="false">');
 embedTxt += ' menu="false"';
 document.writeln('<param name="allowScriptAccess" value="always" />');
 embedTxt += ' allowScriptAccess="always"';
 if (strFlashVars)
 {
  document.writeln('<PARAM NAME=FlashVars VALUE="'+strFlashVars+'">');
  embedTxt += ' FlashVars="'+strFlashVars+'"';
 } 
 document.writeln('<param name="movie" value="'+strURL+'" />');
 if (strQuality)
 {
  document.writeln('<param name="quality" value="'+strQuality+'" />');
  embedTxt += ' quality="'+strQuality+'"';
 }
 else
 {
  document.writeln('<param name="quality" value="High" />');
  embedTxt += ' quality="High"';
 }
 if (strBkColor)
 {
  document.writeln('<param name="bgcolor" value="'+strBkColor+'" />');
  embedTxt += ' bgcolor="'+strBkColor+'"';
 }
 embedTxt += ' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"  swLiveConnect="true" ></embed>';
 document.writeln(embedTxt);
 document.writeln('</object>');
}
//-->

调用方法:
首先,添加引用脚本,放在<head>与</head>之间。

<script language="javascript" src="inc_js/helper_writeflashblock.js"></script>

然后要显示FLASH的地方,替换为:

<script language="javascript">
     <!--   WirteFlashBlock("images/jordan_01.swf","1002","271");
     //-->
     </script>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值