Mercurial > hg > index.fcgi > www > www-1
annotate pics/np_keys.js @ 127:3192e40f5eaf
myw2: update radar URL
author | paulo |
---|---|
date | Fri, 17 Dec 2021 09:10:00 +0000 |
parents | |
children |
rev | line source |
---|---|
paulo@25 | 1 function getKeypress(e) { |
paulo@25 | 2 c = null |
paulo@25 | 3 |
paulo@25 | 4 if (e.which == null) |
paulo@25 | 5 c = String.fromCharCode(e.keyCode); // IE |
paulo@25 | 6 else if (e.which != 0 && e.charCode != 0) |
paulo@25 | 7 c = String.fromCharCode(e.which); // All others |
paulo@25 | 8 |
paulo@25 | 9 if (c != null) { |
paulo@25 | 10 if (c == 'n') |
paulo@25 | 11 goHref('next'); |
paulo@25 | 12 else if (c == 'p') |
paulo@25 | 13 goHref('prev'); |
paulo@25 | 14 else if (c == 'u') |
paulo@25 | 15 goHref('up'); |
paulo@25 | 16 } |
paulo@25 | 17 } |
paulo@25 | 18 |
paulo@25 | 19 function goHref(id) { |
paulo@25 | 20 window.location.href = document.getElementById(id).href; |
paulo@25 | 21 } |
paulo@25 | 22 |
paulo@25 | 23 document.onkeypress = getKeypress |