在ie9中上传获取js错误:SCRIPT5007:预期的对象 [英] Uploadify in ie9 getting js error : SCRIPT5007: Object expected
问题描述
我正在尝试在div上绑定uploadify。
当我点击上传按钮时,它显示错误,如 SCRIPT5007:预期的对象。
I am trying to bind uploadify on div.
When I clicked on upload button it show me error like SCRIPT5007: Object expected.
对于下面的演示检查,链接在ie9中拖动div时产生错误
For demo check below link which produced error on dragging of div in ie9
head
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.20/jquery-ui.js"></script>
<script type="text/javascript" src="http://www.uploadify.com/wp-content/themes/uploadify/js/jquery.uploadify.min.js"></script>
正文
<div class="container" id="container">
<div id="uploadify-item"></div>
This container is not draggable in IE9 but it works in Chrome and FF. Why not?
</div>
js
$('#uploadify-item').uploadify({
'swf' : 'http://www.uploadify.com/uploadify/uploadify.swf',
'uploader' : 'http://www.uploadify.com/uploadify/uploadify.php'
});
$("#container").draggable();
参考: http://jsfiddle.net/axzdR/19/
推荐答案
IE9似乎有一个SWFUpload嵌入错误,如果你尝试
在元素上调用getAttribute / removeAttribute / setAttribute,
会引发对象预期错误。我发现swfupload.js中的cleanUp()
函数从
IE9中的对象DOM中删除了所有js函数,包括
getAttribute / removeAttribute / setAttribute。
IE9 seems to have a bug with SWFUpload embeds, whereby if you try to call "getAttribute / removeAttribute / setAttribute" on the element, an "object expected" error is raised. And I found that the cleanUp() function in the swfupload.js remove all the js functions including "getAttribute / removeAttribute / setAttribute" from the object DOM in IE9.
解决此问题
在SWFUpload.prototype.cleanUp
In SWFUpload.prototype.cleanUp
更改:
if (typeof (movieElement[key]) === "function")
收件人:
if (typeof (movieElement[key]) === "function" && key[0] <= 'Z') // Remove only Flash functions (starts with capital letters).
uploadify的补丁版本保存在此位置
Patched version of uploadify is kept at this location
http://www.dariowiz.com/scripts/jquery.uploadify3.1Fixed.js
问候。
这篇关于在ie9中上传获取js错误:SCRIPT5007:预期的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!