Dialog Boxes

Alert Dialogs
    <!DOCTYPE html>
    <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta charset="utf-8" />
        <title>Alert Dialogs</title>
        <script>
            window.onload = function () {
                document.getElementById('myBtn').addEventListener('click', alertUser);
            }
            function alertUser(e) {
                alert("Button Pressed");
            }
        </script>
    </head>
    <body>
        <div id="result"></div>
        <button id="myBtn">Press Me</button>
    </body>
    </html>
        
Top

Index

Confirm Dialogs
    <!DOCTYPE html>
    <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta charset="utf-8" />
        <title>Confirm Dialogs</title>
        <script>
            window.onload = function () {
                var result = confirm("Are you ready?");
                alert(result);
            }
        </script>
    </head>
    <body>

    </body>
    </html>
        
Top

Index

Prompt Dialogs
    <!DOCTYPE html>
    <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta charset="utf-8" />
        <title>Prompt Dialogs</title>
        <script>
            window.onload = function () {
                var name = prompt("What is your name?");
                var age = prompt("What is your age?");
                alert(name + " is " + age + "years old.");
            }

        </script>
    </head>
    <body>

    </body>
    </html>
        
Top

Index

n4jvp.com