this问题
<script type="text/javascript">
$(function(){
//alert("fdsa");
var e = {
init: function() {
this.$bigCateItem = $(".list-items");
this.$divmenu = $("#J_menu");
this.$ulmenu = $(".life-left-menu");
var j = this;
j.bindEvent()
},
bindEvent: function() {
this.$bigCateItem.bind("mouseenter", this.onmouseenter);
},onmouseenter:function(){
this.addclass("list-hover");
}
};
e.init()
})
</script>
现在报错:TypeError: this.addclass is not a function
[在此错误处中断]
this.addclass("list-hover");
怎么解决啊
------解决方案-------------------- init: function() {
var _this = this;
this.$bigCateItem = $(".list-items");
this.$divmenu = $("#J_menu");
this.$ulmenu = $(".life-left-menu");
var j = this;
j.bindEvent()
},
bindEvent: function() {
this.$bigCateItem.bind("mouseenter", this.onmouseenter);
},onmouseenter:function(){
_this.addclass("list-hover");
}