欢迎光临慧择生活网!
 
您的位置:首页 > 软件资讯

如何调用Flash才符合Web网页标,准

2020-08-10 06:11:30     来源:慧择生活网

  常有网友提问,如何让网页中嵌入的Flash标签也符合web标准。目前还没有一个完美的解决办法,这篇文章中,我们将Flash嵌入标签写入js文件中,通过变量传递参数的办法来回避不符合标准的标签。

  请注意,这只是一个变通的方法,换汤不换药,并未能最终解决存在的问题,通过验证只是一种表象,这样的思路是不是可取,在实际操作中请大家自行斟酌。

  首先建立一个JS文件flash.js,写入如下代码:

  function swf(file,w,h) {

  document.write('<object classid=http://dntxw.com/skin/default/image/nopic.gifclsid:D27CDB6E-AE6D-11cf-96B8-444553540000http://dntxw.com/skin/default/image/nopic.gif codebase=http://dntxw.com/skin/default/image/nopic.gifhttp://download.macromedia.com/pub/

shockwave/cabs/flash/swflash.cab#version=7,0,19,0http://dntxw.com/skin/default/image/nopic.gif width=http://dntxw.com/skin/default/image/nopic.gif'+w+'http://dntxw.com/skin/default/image/nopic.gif height=http://dntxw.com/skin/default/image/nopic.gif'+h+'http://dntxw.com/skin/default/image/nopic.gif> ');

  document.write('<param name=http://dntxw.com/skin/default/image/nopic.gifmoviehttp://dntxw.com/skin/default/image/nopic.gif value=http://dntxw.com/skin/default/image/nopic.gif' + file + 'http://dntxw.com/skin/default/image/nopic.gif>');

  document.write('<param name=http://dntxw.com/skin/default/image/nopic.gifqualityhttp://dntxw.com/skin/default/image/nopic.gif value=http://dntxw.com/skin/default/image/nopic.gifhighhttp://dntxw.com/skin/default/image/nopic.gif> ');

  document.write('<param name=http://dntxw.com/skin/default/image/nopic.gifwmodehttp://dntxw.com/skin/default/image/nopic.gif value=http://dntxw.com/skin/default/image/nopic.giftransparenthttp://dntxw.com/skin/default/image/nopic.gif> ');

  document.write('<param name=http://dntxw.com/skin/default/image/nopic.gifmenuhttp://dntxw.com/skin/default/image/nopic.gif value=http://dntxw.com/skin/default/image/nopic.giffalsehttp://dntxw.com/skin/default/image/nopic.gif> ');

  document.write('<embed src="http://dntxw.com/skin/default/image/lazy.gif" class="lazy" original="http://dntxw.com/skin/default/image/nopic.gif"' + file + 'http://dntxw.com/skin/default/image/nopic.gif quality=http://dntxw.com/skin/default/image/nopic.gifhighhttp://dntxw.com/skin/default/image/nopic.gif pluginspage=http://dntxw.com/skin/default/image/nopic.gifhttp://www.macromedia.com/go/getflashplayerhttp://dntxw.com/skin/default/image/nopic.gif type=http://dntxw.com/skin/default/image/nopic.gifa

7080电影网[www.aikan.tv/special/7080dianyingwang/]pplication/x-shockwave-flashhttp://dntxw.com/skin/default/image/nopic.gif width=http://dntxw.com/skin/default/image/nopic.gif'+w+'http://dntxw.com/skin/default/image/nopic.gif height=http://dntxw.com/skin/default/image/nopic.gif'+h+'http://dntxw.com/skin/default/image/nopic.gif></embed> ');

  document.write('</object> ');

  }

  上面的js脚本定义了一个函数swf,并设置三个变量,它们分别是:flile文件链接,w宽度,h高度。在XHTML中向这个函数传递变量即可实现flash的嵌入。如下代码:

  <div id=http://dntxw.com/skin/default/image/nopic.gifflashhttp://dntxw.com/skin/default/image/nopic.gif>

  <script type=http://dntxw.com/skin/default/image/nopic.giftext/javascripthttp://dntxw.com/skin/default/image/nopic.gif language=http://dntxw.com/skin/default/image/nopic.gifjavascripthttp://dntxw.com/skin/default/image/nopic.gif>swf('designyesky.swf','500','220');</script>

  </div>

  建立id为flash的div作为一容器,在其内部嵌入js脚本,变量依次为:文件路径、宽度、高度。

  看下面的全部代码:

  <!DOCTYPE html PUBLIC http://dntxw.com/skin/default/image/nopic.gif-//W3C//DTD XHTML 1.0 Transitional//ENhttp://dntxw.com/skin/default/image/nopic.gif http://dntxw.com/skin/default/image/nopic.gifhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtdhttp://dntxw.com/skin/default/image/nopic.gif>

  <html xmlns=http://dntxw.com/skin/default/image/nopic.gifhttp://www.w3.org/1999/xhtmlhttp://dntxw.com/skin/default/image/nopic.gif>

  <head>

  <meta http-equiv=http://dntxw.com/skin/default/image/nopic.gifContent-Typehttp://dntxw.com/skin/default/image/nopic.gif content=http://dntxw.com/skin/default/image/nopic.giftext/html; charset=gb2312http://dntxw.com/skin/default/image/nopic.gif />

  <title>符合web标准的嵌入Flash的方法</title>

  <script type=http://dntxw.com/skin/default/image/nopic.giftext/javascripthttp://dntxw.com/skin/default/image/nopic.gif language=http://dntxw.com/skin/default/image/nopic.gifjavascripthttp://dntxw.com/skin/default/image/nopic.gif src="http://dntxw.com/skin/default/image/lazy.gif" class="lazy" original="http://dntxw.com/skin/default/image/nopic.gifflash.jshttp://dntxw.com/skin/default/image/nopic.gif"></script>

  <style type=http://dntxw.com/skin/default/image/nopic.giftext/csshttp://dntxw.com/skin/default/image/nopic.gif>

  #flash { width:500px; margin:50px auto; border:5px solid #03c;}

  </style>

  </head>

  <body>

  <div id=http://dntxw.com/skin/default/image/nopic.gifflashhttp://dntxw.com/skin/default/image/nopic.gif>

  <script type=http://dntxw.com/skin/default/image/nopic.giftext/javascripthttp://dntxw.com/skin/default/image/nopic.gif language=http://dntxw.com/skin/default/image/nopic.gifjavascripthttp://dntxw.com/skin/default/image/nopic.gif>swf(designyesky.swf','500','220');</script>

网站简介 | 版权声明 | 联系我们 | 广告服务 | 工作邮箱
Copyright © 2013-2020 慧择生活网 All rights reserved