Artificial intelligence, zero-based entry! http://www.captainbed.net/inner
code show as below:
right_out.onclick = function(){
var lis = ul.getElementsByTagName('li');
var temp = lis[lis.length-1].innerHTML;
ul.removeChild(lis[lis.length-1]);
alert(temp);
}
The removeChild line is clearly above, why is the alert statement executed first?
Then I tried to add the setTimeOut timer to the alert statement, and the result was still the same.
var lis = ul.getElementsByTagName('li');
var temp = lis[0].innerHTML;
ul.removeChild(lis[0]);
setTimeout(function(){
alert(temp)
},1000);