Javascript 无法获取属性';隐藏&x27;jquery
为什么我在internet explorer上的这段代码有错误,所有其他浏览器都可以正常工作,只有IE是个问题Javascript 无法获取属性';隐藏&x27;jquery,javascript,jquery,internet-explorer,Javascript,Jquery,Internet Explorer,为什么我在internet explorer上的这段代码有错误,所有其他浏览器都可以正常工作,只有IE是个问题 Unable to get property 'hide' of undefined or null reference Unable to get property 'show' of undefined or null reference 代码 代码的其余部分 var onload = function() { $this.unbind('load', o
Unable to get property 'hide' of undefined or null reference
Unable to get property 'show' of undefined or null reference
代码
代码的其余部分
var onload = function()
{
$this.unbind('load', onload);
$wrap = $('<div id="profile_changer_wrap"/>');
$this.wrap($wrap);
if(data.data['type'] == 'avatar'){
var lngEdit = 'Edit Profile Image';
var class_c = 'profile_img';
}else if(data.data['type'] == 'banner'){
var lngEdit = 'Edit Cover Image'
var class_c = 'cover_img';
};
$button = $('<div id="profile_changer_button" class="'+class_c+'">'+lngEdit+'</div>').insertAfter($this);
$button.css(
{
'top': ($this.outerHeight(true) - $button.height())/2 - 5,
'left': ($this.outerWidth(true) - $button.width())/2 - 10
});
};
var onload=function()
{
$this.unbind('load',onload);
$wrap=$('');
$this.wrap($wrap);
if(data.data['type']=='avatar'){
var lngEdit='编辑配置文件图像';
var class_c=‘profile_img’;
}else if(data.data['type']=='banner'){
var lngEdit='编辑封面图像'
风险值类别c=‘保险金额’;
};
$button=$(''+lngEdit+'')。插入($this);
$button.css(
{
'top':($this.outerHeight(true)-$button.height())/2-5,
“left”:($this.outerWidth(true)-$button.width())/2-10
});
};
我们可能需要看到更多类似数据对象的代码,$button变量来自哪里?我们需要查看所涉及的全部代码才能给您一个适当的答案。您是否将$button
声明为全局变量?您说过它在其他浏览器中工作正常,唯一的问题是IE(一如既往:/)。如何绑定onload
函数?您正在使用jQuery吗?窗口。加载?或者addEventListener
?听起来好像IE中的页面上没有包含jQuery。您是否使用https://但将jQuery.js与http://链接?如果是这样,您可以尝试将https://替换为simply//。你有链接要分享吗?
var onload = function()
{
$this.unbind('load', onload);
$wrap = $('<div id="profile_changer_wrap"/>');
$this.wrap($wrap);
if(data.data['type'] == 'avatar'){
var lngEdit = 'Edit Profile Image';
var class_c = 'profile_img';
}else if(data.data['type'] == 'banner'){
var lngEdit = 'Edit Cover Image'
var class_c = 'cover_img';
};
$button = $('<div id="profile_changer_button" class="'+class_c+'">'+lngEdit+'</div>').insertAfter($this);
$button.css(
{
'top': ($this.outerHeight(true) - $button.height())/2 - 5,
'left': ($this.outerWidth(true) - $button.width())/2 - 10
});
};