Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- JavaScript location = bookmark/id on same page?


Drag_Racer - 2:05 pm on Apr 27, 2007 (gmt 0)


I think this is funny, and I don't know why, but this was fun... :)

here is what your looking for JAB, no form needed and jumps to anchors by keystrokes.

just change the letters in p=/abcd/ to what ever you use in your anchor names

<script type="text/javascript">
function goTO(e){
var x=String.fromCharCode(e.which).toLowerCase();
var p=/[abcd]/gi;
if(p.test(x)){
window.location.hash=x;
}
}
document.onkeyup=goTO;
document.captureEvents(Event.KEYUP);
</script>

<a name="a"><!-- --></a><h1>header a</h1>
<a name="b"><!-- --></a><h1>header b</h1>
<a name="c"><!-- --></a><h1>header c</h1>
<a name="d"><!-- --></a><h1>header d</h1>


Thread source:: http://www.webmasterworld.com/javascript/3320399.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com