|
| JAVASCRIPT PROMPT FUNCTION
The prompt() function is used to take an input from a user. It takes and optional text description/instruction as it's argument.
Example:
prompt("Please enter your name");
A prompt will then appear with an instructions of: Please enter your name and a text box for input.
To see a practical application of this, the following example combines a prompt with an alert (try this out for yourself). It prompts you for your name and then alerts a message with your name.
<script type="text/javascript">
var name = prompt("Please enter your name");
if(name !='')
{
alert("Hello " + name);
}
</script>
See Also:
alert()
Displays an alert box with a message and an OK button.
back()
Enables user to go to previous page in the browser's history list - just like using the browsers back button.
prompt()
Opens up a dialogue box for the user to enter some input.
forward()
Enables user to forward to next page in the browser's history list - just like using the browsers forward button.
blur()
When applied to a window, it removes focus from window ie. moves it behind others.
close()
Closes current or any other specified window.
confirm()
The confirm() Method brings up a dialog box with a message and asks a user to choose either OK or Cancel. Returns true or false respectively.
focus()
The Window focus() Object Method gives focus to a specified window ie. moves it in front of other windows.
home()
Same effect as pressing the home button on a browser ie. it takes the user to the page they set as their home page.
moveBy()
Moves the browser window by a specified horizontal and vertical offset in pixels.
moveTo()
Moves the browser window to a specified x and y coordinates.
print()
Prints out the contents of the current window.
stop()
Produces the same effect as clicking the stop button on your browser.
 |
|
|