Today was really productive. Here's what I did:
I didn't write any of my talk for next Wednesday, nor did I proofread any of my book, which is also due on Wednesday. I'm still counting the day as a fantastic success, because it'd have been really tough to cram any more in there.
Re:share?
chromatic on 2003-06-12T06:53:18
The real magic is just adding an identifier to your forward and back links, after you know how to respond to keypress events.
<script>document.captureEvents(Event.KEYPRESS)
function alert_keycode(e)
{
if (e.which == 8)
{
location.href = document.getElementById( 'prev' ).href;
}
else if (e.which == 32)
{
location.href = document.getElementById( 'next' ).href;
}
else if (e.which == 96)
{
location.href = document.getElementById( 'toc' ).href;
}
}
document.onkeypress=alert_keycode</script>I figured out the key values with
alert( e.which );
in the function.Re:share?
lachoy on 2003-06-12T14:13:49
Excellent. I'd figured you identified the link by the ID to know where to jump on command, but it's been so long since I did anything with JS that I didn't know about the 'getElementById()' shortcut. Thanks!