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

How to create an input box?

Ads

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>









Ads

Advertisement