日期:2014-05-16 浏览次数:20365 次
<ul>
<li>li1</li>
<li class='mouseover'>mouseover</li>
<li class='mouseout'>mouseout</li>
<li class='mouseover'>mouse over</li>
<li class='mouseout'>mouse out</li>
</ul>
$("li.mouseover").each(function() {
$(this).bind("mouseover", function() {
alert($(this).text());
});
});
$("li.mouseout").each(function() {
$(this).bind("mouseout", function() {
alert($(this).text());
});
});
<li idx='1'></li>
var imgs = {
"1": "../../xxx.jpg"
}
var idx = $("li").attr("idx");
var imgUrl = imgs[idx];