JavaScript 不工作 SWFObject 未定义
我收到此错误“Microsoft JScript 运行时错误:'SWFObject' 未定义”
我的代码如下所示
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<div id="flashcontent">This text is replaced by the Flash movie. </div>
<script type="text/javascript">
var rndPick = 2;
var rndPick = Math.floor(Math.random() * 16) + 1;
var movie = "/Flash/sam" + rndPick + ".swf";
var so = new SWFObject(movie, "mymovie", "955", "170", "8", "#336699");
so.write("flashcontent");
setTimeout("location.reload(true);", 14500);
</script>
I am getting this error "Microsoft JScript runtime error: 'SWFObject' is undefined"
my code looks like this
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<div id="flashcontent">This text is replaced by the Flash movie. </div>
<script type="text/javascript">
var rndPick = 2;
var rndPick = Math.floor(Math.random() * 16) + 1;
var movie = "/Flash/sam" + rndPick + ".swf";
var so = new SWFObject(movie, "mymovie", "955", "170", "8", "#336699");
so.write("flashcontent");
setTimeout("location.reload(true);", 14500);
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您使用的是 SWFObject 1.5 语法,但链接到 SWFObject 2.2 JS 文件。 SWFObject 1.5 和 2.2 不兼容。
重写您的 SWFObject 代码以使用 2.2 语法。以下是转换为 SWFObject 2.2 语法的代码。请注意,当 DOM 完成加载时,swfobject.embedSWF 会自动执行。
You're using SWFObject 1.5 syntax, but linking to the SWFObject 2.2 JS file. SWFObject 1.5 and 2.2 are incompatible.
Rewrite your SWFObject code to use the 2.2 syntax. Here is your code converted to SWFObject 2.2 syntax. Note that swfobject.embedSWF is automatically executed when the DOM has finished loading.