日期:2014-05-17  浏览次数:20491 次

求解释代码
<script type="text/javascript">
  var focus_width = 299;
  var focus_height = 200;
  var focus_height = 200;
  var text_height = 23;
  var swf_height = focus_height + text_height;
  var swf_height = focus_height;
  var pics = "LS/flash/4.png|LS/flash/1.png|LS/flash/2.png|LS/flash/3.png";
  var texts = "|||";
  var links = "index.aspx|index.aspx|index.aspx|index.aspx";
  var keyword = "||||";

  document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="' + focus_width + '" height="' + swf_height + '">');
  document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="LS/flash/pix.swf"><param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">');
  document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
  document.write('<param name="FlashVars" value="pics=' + pics + '&links=' + links + '&texts=&keyword=' + keyword + '&borderwidth=' + focus_width + '&borderheight=' + focus_height + '&textheight=' + text_height + '">');
  document.write('<embed src="flash/pix.swf" wmode="opaque" FlashVars="pics=' + pics + '&links=' + links + '&texts=&keyword=' + keyword + '&borderwidth=' + focus_width + '&borderheight=' + focus_height + '&textheight=' + text_height + '" menu="false" bgcolor="#eeeeee" quality="high" width="' + focus_width + '" height="' + swf_height + '" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
  document.write('</object>');
  </script></div>

------解决方案--------------------
var 声明变量,因为JS是弱类型的语言,变量类型是自动判断的
 document.write 打印输出函数,这里是输出一段HTML代码

整个JS代码的含义就是输出一段用来播放Flash的HTML代码。<embed>这个标签经常用来连接外部音频和视频。