JavaScript Prompt Box : Accepting Data Value from User using Prompt box
Prompt Box
- Prompt() is a method of the window object.
- It is similar with alert box except for one addition.
- Prompt Box have “Cancle Button” on the pop up window.
- Prompt Box have “textbox” , which allows user to enter value.
Sample Example
<html> <head> <script type="text/javascript"> function show_prompt() { var name=prompt("Please enter your name","Pritesh"); if(name!=null && name!="") { document.write("<p>Hello " + name + "</p>"); } } </script> </head> <body> <input type="button" onclick="show_prompt()" value="Show prompt box"/> </body> </html>
Output :
- Script will get input from textbox.
- If user clicks “OK” then input will be accepted and accepted input gets processed.
- If user clicks “Cancle” then input will be rejected and popup winodow will be closed.
Output :
Download Prompt Box Example : Click Here
Incoming search terms:
- addition in javascript values given by user in prompt box (1)
- addition of prompt box values (1)
- how read the data using prompt box (1)
- how to allow users to enter object data in c using javascript (1)
- how to popup a window accepting values in javascript (1)
- html javascript popup window boxes getting input download (1)