I would create a global variable to see if javascript is waiting for a keystroke.
At the top of the script you can add
var waitingForEnter = false;
Then set to true in your function
function appear() { document.getElementById("firstt").style.visibility="visible"; waitingForEnter = true; }
Then ... add a listener for the enter key
function keydownHandler(e) { if (e.keyCode == 13 && waitingForEnter) { // 13 is the enter key document.getElementById("startrouter").style.visibility="visible"; waitingForEnter = false; // reset variable } } // register your handler method for the keydown event if (document.addEventListener) { document.addEventListener('keydown', keydownHandler, false); } else if (document.attachEvent) { document.attachEvent('onkeydown', keydownHandler); }
Hope this helps. This is what I would do, it may not be the best approach.
source share