|
10/4 -
DIV Template
|
||
Javascript Prompts
Javascript Prompts are like Javascript Alerts. However, with a prompt, the user can enter text in, which you can then use in your page!
Woah! Cool, hey? Well, now I'm going to show you how to do it.
Okay, the '<script type="text/javascript">' part notifies the browser that the code ahead will be written in Javascript. The 'prompt("Please Enter Your Name", "");' part executes the promt popup. The first part, 'Please enter your name' is the text which shows above the input box. The '""' part is the value of the box. If you wanted something else, you'd just place it between the two (")'s. Finally, the '</script>' part notifies the browser to quit Javascript mode, and return to normal HTML Mode. If you wanted to use the text which the user inputted, you'd use the following code.
The only difference there being the variable declaration. So, now you can use the input in a different alert of something else, like so.
There ya go. The little ' + name + ' denotes where the variable is to appear. |
||