我找到了一些方法将 swf 嵌入到 html 页面中...这是代码...
<object id="swfobj" style="display:none; margin-right: 385px;" classid="clsid:D27CDB6E- AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
width="309" height="200">
<param name="movie">
<param name="quality" value="high">
<embed style="margin-left: 18px;border:1px solid #999999;" quality="high" width="309" height="200" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
</embed>
然后在 JavaScript 部分我有这个
function openfile(filePath) {
$("#swfobj > EMBED").attr("src", filePath);
$("#swfobj").fadeIn("slow");
};
现在我有两个问题
1.此代码在 Firefox 中可以工作,但在 Chrome 中会崩溃...它仅在我单击第一个元素时才工作,然后停止工作...如何使此跨浏览器?
2.我想在浏览器的新选项卡中打开 swf...我该怎么做?
最佳答案
在你的函数中添加:
my_window = window.open("myflash.html", "mywindow1", "status=1,width=309,height=200");
my_window.document.write($("#swfobj").html());
这将打开一个新窗口(myflash.html,您必须创建它),其中包含 id 为 #swfobj
的 object
的 html。
请记住,您必须使 #swfobj
在新窗口中可见。所以添加
swfobj {
display:block !important;
}
在 myflash.html 中(需要!important
来覆盖#swfobj
的内联display:none
以上内容适用于 Firefox 和 Chrome,但您必须启用弹出窗口。
关于javascript - 将 swf 嵌入 html 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7064192/