html页面如下:
<div>
<img src="images/sex/nv.png" onmouseenter="imgShow(this)" onmouseleave="imgHide(this)"/>
<img src="images/sex/nan.PNG" class="perImg">
</div>
原js代码:
function imgShow(myObj){
myObj.next().show(); //相邻兄弟显示
}
function imgHide(myObj){
myObj.next().hide();//相邻兄弟隐藏
}
报错:Uncaught TypeError: this.next is not a function
将js代码改为:`
function imgShow(myObj){
$(myObj).next().show();
}
function imgHide(myObj){
$(myObj).next().hide();
}