How to display Alert in JavaScript

Answer Posted / veerahema

<!DOCTYPE html>
<html>
<body>

<h1>The Window Object</h1>
<h2>The alert() Method</h2>

<p>Click the button to display an alert box.</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
alert("Hello! I am an alert box!");
}
</script>

</body>
</html>

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Who created npm?

488


How to test a string as a literal and as an object ?

556


What is the importance of javascript? Expalin

525


What is undefined x 1 in JavaScript?

508


What typeof returns for a null value?

532






Explain closures in javascript?

490


What is the requirement of debugging in javascript?

488


How do I open javascript in browser?

463


What is the concept of “functions as objects” and how does this affect variable scope?

483


List some features of javascript.

551


How to remove the event listener?

535


Why is javascript used for web pages?

439


How to reload a page using JavaScript?

541


What is double exclamation point?

524


What does js stand for?

472