The line in question is the var el2. I'm looking to hilite both the h element the script scrolls to * and * the next main block element (h, p, div, pre etc) below it. The best I've done so far is this:
/* ScrollToThenFlash */(function(){var d=document;d.body.appendChild(d.createElement('script')).text="(function(){var d=document;function findPos(obj){var curtop=0;if(obj.offsetParent){do{curtop+=obj.offsetTop}while(obj=obj.offsetParent);return [curtop]}};d.onclick=function(){var dael=d.activeElement;dael.style.background='#ff9 !important';dael.style.color='#444 !important';if(dael.href.indexOf('#')!=-1 && d.all[dael.href.split('#')[1]]){function flash(rep, delay){for(var i=rep;i>0;i--){setTimeout('el.style.background=\"yellow !important\";el2.style.background=\"yellow !important\";', delay*i*2);setTimeout('el.style.background=elbg;el2.style.background=elbg2;', delay*((i*2)+1))};};el=d.all[d.all[dael.href.split('#')[1]].sourceIndex];
el2=d.all[d.all[dael.href.split('#')[1]].sourceIndex+1];elbg=el.style.background;elbg2=el2.style.background;scroll(0, findPos(el));flash(7,130);return false}else return true;/* alert('leaving this page!'); */};})()";})();
It works as intended here (click on the nav links at the top of the pg): http://jibbering.com/faq/notes/closures/
But it only hilites the h element here: www.opera.com/docs/userjs/specs/
I've experimented with variations on:
el2=el.nextSibling? d.all[el.nextSibling.sourceIndex] : el.parentNode.nextSibling? d.all[el.parentNode.nextSibling.sourceIndex] : d.all[d.all[dael.href.split('#')[1]].sourceIndex+1];
But the browser (IE6 Moz4) won't have any of it. Any advice html or js related is welcome.