Javascript alert message box

JavaScript alert()

Use the alert command in JavaScript to create a message alert box:

alert("I was prompted text!");
Run the example, result shown in the following figure:

Message alert box is a dialogue mode, when the warning box appears, the user needs to click the OK button to close the warning box before proceeding.

The alert command has one parameter, the text string that you want the user to display, which is not in HTML format.

The message alert box displays multiple lines of text

For multi-line display prompt text, you need to add a newline at the line break (not the <br />)

alert("I am prompted text! \n I am wrapping text.");

In this example, the text "I am wrapping text." Will be displayed in a newline.

Copyright 2014-2017 by All Rights Reserved.