我正在尝试在 div 上绑定(bind) uploadify。
当我点击上传按钮时,它显示错误,如 SCRIPT5007: Object expected.
对于以下链接的演示检查,它在 ie9 中拖动 div 时产生了错误
头
<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();
最佳答案
IE9 似乎有一个 SWFUpload 嵌入的错误,因此如果你尝试 在元素上调用“getAttribute/removeAttribute/setAttribute”, 引发“预期对象”错误。我发现 cleanUp() swfupload.js 中的函数删除所有 js 函数,包括 "getAttribute/removeAttribute/setAttribute"从对象 DOM 中 IE9.
解决这个问题
在 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 的补丁版本保存在这个位置
http://www.dariowiz.com/scripts/jquery.uploadify3.1Fixed.js
问候。
关于javascript - 在ie9中上传得到js错误: SCRIPT5007: Object expected,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16145365/