DelphiFAQ Home Search:

How to prompt the user with an inputbox in Javascript


comments17 comments. Current rating: 4 stars (8 votes). Leave comments and/ or rate it.


Is there a Javascript function similar to the "InputBox" function in VBScript?


Yes, use prompt(Question, Default) as shown below.

<script type="text/javascript">

var answer = prompt ("What is your age?","20");
alert ("You are " + answer + " years old.")

// -->

Content-type: text/html


You are on page 2 of 2, other pages: 1 [2]
2013-06-12, 21:09:21
christian from Bolivia  
2013-06-21, 06:43:42
anonymous from France  
Great :> !
You are on page 2 of 2, other pages: 1 [2]



NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: