Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JavaScriptQuestions How to create an input box?

Have Programming Question? Ask it here!
 
 
 


samar
How to create an input box?
1 Answer(s)      3 years and 9 months ago
Posted in : JavaScript Questions


How to create an input box?


Advertisement
View Answers

November 10, 2010 at 6:05 PM


A prompt box is often used if you want the user to input a value before entering a page.

When a prompt box pops up, the user will have to click either "OK" or "Cancel" to proceed after entering an input value.

If the user clicks "OK" the box returns the input value. If the user clicks "Cancel" the box returns null.

<script type="text/javascript">
         var name = prompt("What is your name", "Type you name here");
document.write("Hi " + name + "\nHope you are enjoying JavaScript!");
      </script>


Related Tutorials/Questions & Answers:
Advertisements
 

 

 

DMCA.com