我有
<ul id="notifications">
<li onclick="toggleArrived('{{Aircraft}}',this)"><div class="top notoff"><img src="../lib/img/arrived.png" /></div><div class="bottom notoff">Arrived</div></li>
<li onclick="toggleBoard('{{Aircraft}}',this)"><div class="top notoff"><img src="../lib/img/board.png" /></div><div class="bottom notoff">Ok to Board</div></li>
<li onclick=""><div class="top notoff"><img src="../lib/img/done.png" /></div><div class="bottom notoff">Done</div></li>
</ul>
现在点击第一个“li”,我也想更改最后一个“li”。
function toggleArrived(ac,obj) {
for (var i=0;i<data.Aircrafts.length;i++) {
if (data.Aircrafts[i].Aircraft==ac) {
if (obj.childNodes[0].className=="top notoff") {
data.Aircrafts[i].Aircraft.Arrived="YES";
obj.childNodes[0].className="top noton";
obj.childNodes[1].className="bottom noton";
??? if ($("#notifications li:last-child.childNodes[0]").className =="top notoff") {
$("#notifications li:last-child.childNodes[0]").className = "top noton";
$("#notifications li:last-child.childNodes[1]").className = "bottom noton";
}
} else {
data.Aircrafts[i].Aircraft.Arrived="NO";
obj.childNodes[0].className="top notoff";
obj.childNodes[1].className="bottom notoff";
}
}
}
}
我怎么做?