Javascript alert dialog box example

Javascript alert dialog box is used to display a warning message to the users.
Note: Alert dialog box gives one button “OK”.


<!DOCTYPE html>
function giveWarning() {
   alert("Warning message.");
   document.write ("Warning message.");
<p>Click Submit button and see result.</p>      
 <input type="button" onclick="giveWarning()" value="Submit" />

Try it:

JS Bin on

Comments are closed.