谁能告诉我为什么这个.SWF加载到IE但没有firefox或chrome?

时间:2011-03-28 18:03:37

标签: javascript

试图找出为什么这个通过javascript加载的swf是一个要求将加载,但不是任何其他浏览器

HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Host&nbsp;Log-in</title>

<!-- saved from url=(0014)about:internet -->
<style type="text/css">
body {
    background-color: #FFFFFF;
}
</style>
</head>

<body style="margin: auto;" onLoad="javascript: sf.focus()">
<br />
<script type="text/javascript" language="javascript">
<!--
  function doFSCommand(command, args) {
  }
//-->
</script>

<script language="VBscript" type="text/javascript">
<!--
  sub sf_FSCommand(ByVal command, ByVal args)
    call doFSCommand(command, args)
  end sub
//-->
</script>

<img src="/img/infinite-logo.png" width="248" height="85" alt="Infinite"><br>

<script language="javascript" src="swf.js" ></script>

<br>
</body>
</html>

JS:

document.write('<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="1280" height="753" ID="sf" VIEWASTEXT>');
document.write('  <param name="movie" value="Host Log In.swf" />');
document.write('  <param name="menu" value="false" />');
document.write('  <param name="quality" value="high" />');
document.write('  <param name="wmode" value="window" />');
document.write('  <param name="allowScriptAccess" value="always" />');
document.write('  <param name="allowFullScreen" value="true" />');
document.write('  <embed src="Host Log In.swf" quality="high" name="sf" allowScriptAccess="always" allowFullScreen="true" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1280" height="753"></embed>');
document.write('</object>');

2 个答案:

答案 0 :(得分:1)

<embed>标记不应位于<object>内。尝试将其移到<object>标记之外,看看是否有帮助。

答案 1 :(得分:0)

document.write('<object classid="... height="753" ID="sf" VIEWASTEXT>'); 
...
document.write('</object>');

以这种方式创建节点是一个坏主意。请改用document.createDocumentFragment()