走过路过不要错过,帮忙看下错在哪了
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);