Monday, September 15, 2014

JavaScript 2.0

15th Week (September 08-12)

In this week, we started tackling the three different methods in JavaScript.

Now, I shared an information about what I have learned in this week.

JavaScript uses dialog boxes to interact with the users. The dialog boxes are created with three methods:
alert ()
prompt ()
confirm ()

Alert Box- method creates a little independent box-called a dialog box--which contains a small triangle with an exclamation point. A user-customized message is placed after the triangle, and beneath it, an OK button. When the dialog box pops up, all execution is stopped until the user presses the OK button in the pop-up box.
Example: alert (It's Superman!")

                                                        Alert Box




                                           Using JavaScript alert box






Prompt Box- often used if you want the user to input a value before entering the page. When a prompt box pops up, the user will have to click either "OK" or "CANCEL" to proceed after entering an input value. If the user click "CANCEL" the box returns null.


Example: prompt ("What is your name? ", name);


Using the JavaScript prompt box






Confirm Box- used to confirm a user's answer to a question. A question mark will appear in the box with an OK button and a Cancel button. If the user presses the OK button, true is returned; if he presses the Cancel button, false is returned. This method takes only one argument, the question you will ask the user.






Note: if you have any questions feel free to comment in the lower box. Thanks guys! :))

Credits to www.w3schools.com for definition of the Prompt 
Box. The definition of the Alert and Confirm Box is from in the hand outs. ☺


Hasta La Vista! ♥ ☺

No comments:

Post a Comment