We continued typing and discussing the JavaScript methods.
Here are the pictures of my work. Yes! I've finished it through hardwork and patience. The alert() method displays an alert box with a specified message and an OK button. An alert box is often used if you want to make sure information comes through to the user.
Note: The alert box takes the focus away from the current window, and forces the browser to read the message. Do not overuse this method, as it prevent the user from accessing other parts of the page until the box is closed.
Question: How do I display a user prompt from JavaScript?
Answer: To display a user prompt dialog, use the JavaScript
prompt() method:
Returned Value:
The value returned by
The value returned by
prompt depends on what exactly the user does with the dialog. If the user types something and then clicks OK or presses Enter, the prompt method returns the user input string. If the user clicks OK or presses Enter without typing anything into the prompt dialog, the method returns the suggested input, as specified in the second argument passed to prompt. If the user dismisses the dialog (e.g. by clicking Cancel or pressing Esc), then in most browsers the prompt method returns null.
Question: How do I display an OK/Cancel dialog box from JavaScript?
Answer: To display an OK/Cancel box, use the
Returned value:confirm() method:If the user clicks OK, the
confirm method returns true. If the user clicks Cancel, the method returns false.Signing off.


0 comments:
Post a Comment