function retSibling(e,n){ while(e && n){ if(n>0){ if(0 && e.nextElementSibling){ e=e.nextElementSibling; }else{ for(e=e.nextSibling;e && e.nodeType!=1;e=e.nextSibling); } n--; }else{ if(e.previousElementSibling){ e=e.previousElementSibling; }else{ for(e=e.previousSibling;e && e.nodeType!=1;e=e.previousSibling); } n++; } } return e; }
<div>
<span></span>
<p></p>
<strong></strong>
<i></i>
<address></address>
</div>
var div=document.getElementsByTagName('div')[0];
var strong=document.getElementsByTagName('strong')[0];
retSibling(strong,2)