js在IE下报 object error

jiuchang jiuchang 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
使用ajaxfileupload实现上传图片的功能,firefox下功能正常。在ie下报object error
出错的代码如下:
	function ajaxFileUpload()
{
$("#loading")
.ajaxStart(function(){
$(this).show();
})
.ajaxComplete(function(){
$(this).hide();
});
$.ajaxFileUpload
(
{
url:'upload.php?do=upload',
secureuri:false,
fileElementId:'fileToUpload',
dataType: 'json',
data:{name:'logan', id:'id'},
success: function (data, status)
{
if(typeof(data.error) != 'undefined')
{
if(data.error != '')
{
alert(data.error+'abc');
}else
{
document.getElementById('photo').value=data.msg;
var node1 = document.getElementById('imgnode1');
var text =
"<br><img src='"+data.msg
+"' width='130' height='160' >"
+"<form name='imgdel' id='imgdel' action='upload.php?do=delete' method='post'>"
+"<input type='hidden' name='file' value='"+data.msg
+"'><input type='button' onclick='return ajaxFileDelete();' value='删除'></form>";
var node2 = document.getElementById('imgnode2');
node2.innerHTML = text;
}
}
},
error: function (data, status, e)
{
alert(e);
}
}
)

return false;
}


通过加alert,已经定位到是node2.innerHTML = text;出错。请大家帮忙看下是什么问题。

网页中相关的代码如下:
			<tr><th align="right">照片</th><td></td>
<td><input name="photo" id="photo" value="" type="hidden" />
<div id="imgnode1">
<input type="file" size=28 name="file" id="fileToUpload" class="input" />
<br />
<input type="button" id="buttonUpload" onclick="return ajaxFileUpload();" value="上传" />
</div>
<div id="imgnode2"> </div>
</td></tr>
...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
jiuchang
JavaScript 87,983 成员 224,681 内容