JavaScript Alert

The JavaScript alert is a dialogue box that pops up and takes the focus away from the current window and forces the web browser to read the message.


1.
<form>
<input type="button" onclick=
"alert('Are you sure you want to call')"
value="See">
</form>


2.
function myFunc() {
alert("executing myFunc!");
return true;
}

3.

for (var i = 0; i < 10; i++) {
var link = document.createElement("a");
link.innerHTML = "Link " + i;
link.href = "#";
link.onclick = function() {
alert("This is link " + i);
return false;
};
document.body.appendChild(link);
}