Language-Specific Built-in Functions
A message box is a rectangular window used to display a message to the user. To display a message box, use the alert() function. This function is used to display a message box that is equipped with a button with a caption as OK. As long as the message box displays, the user must close it in order to return to the browser, meaning the browser is not accessible while the message box is available.
The syntax of the alert() function is:
The argument of this function can be a number.
For example, to display the number 12 when the user clicks a button, you can use code as follows:
Next: Message Box with Options