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

What is use of JavaScript and jquery?

774


How do I open javascript?

692


Which companies are using node js?

639


Difference between window.onload and onDocumentReady?

739


What is scope variable in javascript?

719


Should I learn java first or javascript?

696


How to check if a variable is an integer in javascript ?

789


What is noscript tag?

714


Why it is not advised to use innerhtml in javascript?

694


What does clean white space mean?

629


What does 3+4+"7" evaluate to?

647


What's the difference methods get and post in html forms?

684


Explain the working of timers in javascript?

706


How to add buttons in javascript?

616


What does javascript do?

658