Alert Dialog Box
Alert Dialog Box
Alert Dialog Box is mainly used to give an alert message to the user.
Mainly, Alert Box gives you a warning message if the validation on the input field or a webpage doesn’t fit in the standard criteria.
For example: If the content on a webpage contains data which are not suitable for the persons below age 18. So we need this dialog box which displays message according to this webpage further that if the user fulfills the demands of the webpage then it displays the data. Otherwise, shows the error message.
Alert Dialog Box displays a message with an “OK” to select in order to close the popup.
Code:
<html>
<head>
<title></title>
<script type="text/javascript">
alert("This is an alert message!");
</script>
</head>
<body>
<h1> Hello TutorialsLink!</h1>
</body>
</html>
Here, as per the code when the webpage loaded in the browser then it displays an alert message in a dialog box appears at the top of the page. If disappear only if when we click the “OK” button.
Output: