HOLLA TECH - LEARN

The Alert Box [/su_quote] 

JavaScript offers three types of popup boxes, the Alert, Prompt, and Confirm boxes.

Alert Box
An alert box is used when you want to ensure that information gets through to the user.
When an alert box pops up, the user must click OK to proceed.
The alert function takes a single parameter, which is the text displayed in the popup box.
Example: 

alert(“Do you really want to leave this page?”);

 

Result: 

Holla Tech - Learn JavaScript

To display line breaks within a popup box, use a backslash followed by the character n. 

alert(“Hello\nHow are you?”); 

 

Result: 

Holla Tech - Learn JavaScript

NOTE!
Be careful when using alert boxes, as the user can continue using the page only after clicking OK.

Prompt Box