胖丫
2016-08-18 18:59
function get_previousSibling(n){
var x=n.previousSibling;
while(x && x.nodeType!=1)
{x=x.previousSibling;}
return x;
}
var x=document.getElementsByName("li");
var y=x[x.length-1];
document.write("<br/><br/>"+y.nodeName+"="+y.innerHTML+"<br/>"+"previousSibling:"+get_previousSibling(y).nodeName+get_previousSibling(y).innerHTML);
var x=document.getElementsByTagname('li')
var x=document.getElementsByTagName('li')
JavaScript进阶篇
468192 学习 · 21891 问题
相似问题