我有这个mousedown函数,以获取其父级的索引值:div.combo_list,在Chrome和Firefox中我获得了基于零的良好值,例如0, 1, 2, 4...
奇怪的是IE8给了我:1, 3, 4...
有人知道或承认这种行为吗?
<div class="combo_list " style="width: 143px; display: none; ">
<div style="width: 100%; overflow-x: hidden; overflow-y: hidden; "> </div>
<div style="width: 100%; overflow-x: hidden; overflow-y: hidden; ">ex 1</div>
<div style="width: 100%; overflow-x: hidden; overflow-y: hidden; ">ex 2</div>
<div style="width: 100%; overflow-x: hidden; overflow-y: hidden; ">ex 3</div>
</div>
$("div.combo_list div").live("mousedown", function(){
var nodeIndex = $(this).parent().index();
alert ("" + nodeIndex);
});