annotate pics2/np_keys.js @ 137:e508b772c817

myrss2: FEEDS: add waxy.org
author paulo
date Mon, 09 Jan 2023 12:10:14 +0000
parents
children
rev   line source
paulo@56 1 function getKeypress(e) {
paulo@56 2 c = null
paulo@56 3
paulo@56 4 if (e.which == null)
paulo@56 5 c = String.fromCharCode(e.keyCode); // IE
paulo@56 6 else if (e.which != 0 && e.charCode != 0)
paulo@56 7 c = String.fromCharCode(e.which); // All others
paulo@56 8
paulo@56 9 if (c != null) {
paulo@56 10 if (c == 'n')
paulo@56 11 goHref('next');
paulo@56 12 else if (c == 'p')
paulo@56 13 goHref('prev');
paulo@56 14 else if (c == 'u')
paulo@56 15 goHref('up');
paulo@56 16 }
paulo@56 17 }
paulo@56 18
paulo@56 19 function goHref(id) {
paulo@56 20 window.location.href = document.getElementById(id).href;
paulo@56 21 }
paulo@56 22
paulo@56 23 document.onkeypress = getKeypress