Possible Duplicate:
JavaScript execute until keypress
I've got a function that needs to be played, after the function does it's job the user has to press a key to continue. Does anybody know how to pause the function until a key is pressed?
Thanks in advance
var pause = true;
function bla() {
// your function does stuff
while(pause) {
$(document).bind('keypress', function(e) {
if(e.keyCode == 13) {
pause = false;
}
});
}
// go on doing stuff...
}
Its only idea.
精彩评论