- 1
How cn i code window in witch you can type the answer
18 Respuestas
+ 5
The right answer is to rather use the prompt() box function, and not the alert() one (neither the confirm() ^^)...
But anyway, for handling interactivity/user input, don't use alert/prompt/confirm ps modal windows: that's not user friendly at all :P
You should implement (write or use ready made) user input, output with html elements to keep the user interface inside the web document ;)
Example of such integration/replacement with pure JS of an original code of such real html substitute on another sololearners game improvments:
https://code.sololearn.com/Wp8x1NemoYJ1/?ref=app
Or just implementation of sooner adaptation of a customized yes/no box, also in original pure JS:
https://code.sololearn.com/WO2Mz12InjfP/?ref=app
And the yes/no box code:
https://code.sololearn.com/WlSiILvqHwd9/?ref=app
+ 4
If you have been less lazy and did study my answer/codes, you would have seen that using <input> html form element was the other way to do ^^
+ 3
too much? :D
+ 3
Well, I will forgot you the next time, if you don't like accurate answer and time taken for you ^^
+ 1
var x = prompt ('enter your name');
alert(x);
+ 1
You can also use the HTML <input> tag.
HTML:
<input id="answer">
JavaScript:
var answerBox = document.getElementById("answer");
var answer = answerBox.value;
The variable answer now stores whatever value the user entered before the above lines of code were triggered. You can use a <button> to trigger a function (ie submit the answer) using the attribute onclick="func();".
0
I don't understand. you mean like a prompt in which you request for user input?
0
yes
0
what can u type some short code just to sho me
0
thx
0
im making a game i will tell when im done
0
Okay. can't wait to see.
0
that is one very long reply
0
ok ok sry
0
visph Thank you for the very detailed response to my question, I am sorry I replied to you like that. I came back to see the old projects and comments and I really cringed when I was reading this one. The way I talked to others was just wrong.
- 1
tooooooo much
- 1
just show me what do u type wjen u want dat box to appear
- 1
thx