Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #29899
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2016-03-11 03:13 -0800 |
| References | <6ef267d6-7655-4699-9363-d6e0f613f899@googlegroups.com> <f7aaada6-5407-4764-83e9-0ef13953090a@googlegroups.com> |
| Message-ID | <41dca990-88fe-4829-8fbb-fd8811727776@googlegroups.com> (permalink) |
| Subject | Re: Wait on keyboard |
| From | jonas.thornvall@gmail.com |
Den fredag 11 mars 2016 kl. 11:51:06 UTC+1 skrev jonas.t...@gmail.com:
> Den fredag 11 mars 2016 kl. 11:30:55 UTC+1 skrev jonas.t...@gmail.com:
> > I need to debug, and i real do not like the gist of firefox nor chrome debug.
> >
> > And i kind of like do my own debug printouts, how can i program javascript to wait for keyboard input?
> >
> > Is there something like. wait until pressed key equal space.
> >
> > Is there a way to achieve this because then i will be able to do my own printouts to textareas and i can also see where the loop starts without to get indefinitly stuck or thrown out.
> >
> > So wait on keyboard?
>
> To be honest i find it weird that you have to add a listener and on key handlers it is pretty much 20 linke of code that have to be written.
>
> If i remember correctly it could be ahcieved with a single line in basic using either input or something like getkey.
>
> Is there a reason?
Here is the sample code someone suggested on net, and it makes you wonder.
Do they require the input to come from a specific field in a form????
Isn't there listen for keyboard, what is firstt, how can a programming language be so convoluted that you can not listen for a simple keyboard press without 20 lines of code?
Should not the keyboard listener be implicit in a programming language?
a=getkey();
if (a=="32");
document.write("You pressed return");
How can this end up with constructing code like below that does not even work for the purpose, one can really wonder why javascript bothered implement write but not getkey.
var waitingForEnter = false;
function appear()
{
document.getElementById("firstt").style.visibility="visible";
waitingForEnter = true;
}
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);
}
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Wait on keyboard jonas.thornvall@gmail.com - 2016-03-11 02:30 -0800
Re: Wait on keyboard Tim Streater <timstreater@greenbee.net> - 2016-03-11 10:37 +0000
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-11 02:50 -0800
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-11 03:13 -0800
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-11 03:23 -0800
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-11 03:32 -0800
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-11 03:39 -0800
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-11 04:41 -0800
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-11 05:00 -0800
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-11 05:43 -0800
Re: Wait on keyboard Tim Streater <timstreater@greenbee.net> - 2016-03-11 12:13 +0000
Re: Wait on keyboard "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2016-03-11 21:52 +0800
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-11 07:29 -0800
Re: Wait on keyboard Stefan Weiss <krewecherl@gmail.com> - 2016-03-11 17:00 +0100
Re: Wait on keyboard Stefan Weiss <krewecherl@gmail.com> - 2016-03-11 17:11 +0100
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-11 08:32 -0800
Re: Wait on keyboard Stefan Weiss <krewecherl@gmail.com> - 2016-03-11 20:20 +0100
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-11 08:55 -0800
Re: Wait on keyboard Aleksandro <aleksandro@gmx.com> - 2016-03-11 16:30 -0300
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-11 11:46 -0800
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-11 12:22 -0800
Re: Wait on keyboard Aleksandro <aleksandro@gmx.com> - 2016-03-11 17:25 -0300
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-11 12:32 -0800
Re: Wait on keyboard Aleksandro <aleksandro@gmx.com> - 2016-03-11 17:42 -0300
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-11 12:52 -0800
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-11 12:47 -0800
Re: Wait on keyboard "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-03-11 18:39 -0800
Re: Wait on keyboard "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-03-11 18:37 -0800
Re: Wait on keyboard John Harris <niam@jghnorth.org.uk.invalid> - 2016-03-12 13:16 +0000
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-12 05:57 -0800
Re: Wait on keyboard John Harris <niam@jghnorth.org.uk.invalid> - 2016-03-13 10:31 +0000
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-13 05:55 -0700
Re: Wait on keyboard "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-03-13 17:19 +0100
Re: Wait on keyboard Scott Sauyet <scott.sauyet@gmail.com> - 2016-03-13 13:01 -0700
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-13 15:19 -0700
Re: Wait on keyboard Aleksandro <aleksandro@gmx.com> - 2016-03-13 20:08 -0300
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-13 21:45 -0700
Re: Wait on keyboard Aleksandro <aleksandro@gmx.com> - 2016-03-14 01:50 -0300
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-13 22:39 -0700
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-13 22:46 -0700
Re: Wait on keyboard Scott Sauyet <scott.sauyet@gmail.com> - 2016-03-14 11:54 -0700
Re: Wait on keyboard Tim Streater <timstreater@greenbee.net> - 2016-03-14 08:31 +0000
Re: Wait on keyboard John Harris <niam@jghnorth.org.uk.invalid> - 2016-03-14 10:43 +0000
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-12 06:04 -0800
Re: Wait on keyboard "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-03-12 15:22 +0100
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-12 07:46 -0800
Re: Wait on keyboard Tim Streater <timstreater@greenbee.net> - 2016-03-12 15:52 +0000
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-12 09:25 -0800
Re: Wait on keyboard Aleksandro <aleksandro@gmx.com> - 2016-03-12 20:16 -0300
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-12 15:57 -0800
Re: Wait on keyboard Aleksandro <aleksandro@gmx.com> - 2016-03-12 21:07 -0300
Re: Wait on keyboard Scott Sauyet <scott.sauyet@gmail.com> - 2016-03-12 21:27 -0800
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-13 03:08 -0700
Re: Wait on keyboard "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-03-12 23:30 +0100
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-12 06:15 -0800
Re: Wait on keyboard "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-03-11 18:33 -0800
Re: Wait on keyboard jonas.thornvall@gmail.com - 2016-03-12 03:01 -0800
Re: Wait on keyboard "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-03-11 18:30 -0800
Re: Wait on keyboard Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-12 04:44 +0100
Re: Wait on keyboard Stefan Weiss <krewecherl@gmail.com> - 2016-03-12 11:21 +0100
Re: Wait on keyboard Stefan Weiss <krewecherl@gmail.com> - 2016-03-12 11:27 +0100
Re: Wait on keyboard Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-03-12 14:44 +0100
Re: Wait on keyboard "Mr. Man-wai Chang" <toylet.toylet@gmail.com> - 2016-03-14 18:58 +0800
csiph-web