Home Answers Viewqa JavaScriptQuestions How to create an input box?

 
 


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

How to create an input box?

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 Pages:

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.