Month: September 2021

Javascript keyboard operation

var keyboardfocuskey;var keylist=[1,2,3,4,5]; var currentFocusedKey=1;//input fragment function findElementWithKey( keyboardfocuskey ){ return element ; } function focusOnElement( element ){ } function onEnterEvent(){ newFocusedKey= currentFocusedKey + 1; if(newFocusedKey == keylist.length){focusOnElement( findElementWithKey( newFocusedKey ) );}else if( newFocusedKey == keylist.length ){focusOnElement( findElementWithKey( newFocusedKey ) );}else{newFocusedKey = 1;focusOnElement( findElementWithKey( newFocusedKey ) );} } functoin onShiftEnterEvent(){ newFocusedKey = currentFocusedKey – 1; focusOnElement( findElementWithKey( newFocusedKey ) ); }