Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to create window.prompt Method

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 286
    Comment on it

    With the help of this javascript prompt() function, I have created a dialog box that will be used for taking user input. The prompt() method displays a dialog box that prompts the user to input data

    <!DOCTYPE html>
    <html>
    <head>
    <script type="text/javascript">
    function myPrompt(){
        var promptValue = prompt('Supply text:', 'optional default value');
        if(promptValue != null){
            document.getElementById("status").innerHTML = promptValue;
        }
    }
    </script>
    </head>
    <body>
    <p><input type="button" value="Value" onclick="myPrompt()"></p>
    <h3 id="status">text value...</h3>
    </body>
    </html>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: