Random Ponderings

Introduction

This web page demonstrates the use of the Window.alert() method without any extraneous fluff to confuse the issue.

When the above link is pressed the following dialog is displayed.

Screen shot of the Java Script Alert Dialog. In the title region of the dialog is the text “sullivanandkey.com says”. In the middle of the dialog is the text “Hello world! It truly is a wonderful day to be alive!”. In the bottom right of the dialog is the OK button.

The dialog is displayed by the following line of code.

window.alert('Hello world! It truly is a wonderful day to be alive!');

let showAlertLink = document.getElementById('showAlertLink');
window.alert('Hello world! It truly is a wonderful day to be alive!');
e.preventDefault();
});

Finding out why an alert dialog is being displayed

If you ever encounter a situation where alert dialogs are being displayed for an unknown reason, you can add the following code snippet to your web page.

var originalWindowAlert = window.alert;
}
JavaScriptAlertExample.html:91 console.trace
(anonymous) @ JavaScriptAlertExample.html:97