×

Index

JavaScript Tutorial

JavaScript Examples

CSS Tutorial

CSS Examples

Display Alert Message on Button Click Event using JavaScript

In this code, we will learn how to display an alert message using JavaScript?

Display Alert Message on Button Click Event

HTML and JavaScript:

<!--Display Alert Message on Button Click Event.-->
<html>
    <head>
        <title>Display Alert Message on Button Click Event.</title>
        <script type="text/javascript">
            function showMessage() {
                alert("Hello friends, this is message.");
            }
        </script>
    </head>
    <body>
        <center>
            <h1>Display Alert Message on Button Click Event.</h1>
            <b>Click on button to display message: </b><br />
            <br />
            <input type="button" id="btnShowMsg" value="Click Me!" onClick="showMessage()" />
        </center>
    </body>
</html>

Result:

display alert message on button click event

JavaScript Examples »



Related Examples



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.