DelphiFAQ Home Search:

How to prompt the user with an inputbox in Javascript

 

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

Question:

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

Answer:

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.")

// -->
</script>

Comments:

2007-01-30, 04:45:08
anonymous from India  
rating
2007-01-30, 04:45:33
Anuradha from India  
rating
2007-10-26, 02:53:55
donairl from Surabaya, Indonesia  
rating
thank's for ur help
2007-10-26, 08:08:01
anonymous from France  
(Flagged by you as spam or abusive.)
2007-11-28, 07:27:59
omer@filebilisim.com from Deveciusagi, Turkey  
sukran
2007-12-19, 10:04:44
anonymous from Peru  
<input>
2007-12-21, 07:28:30
anonymous from Netherlands  
rating
bedankt

 

 

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.
 
It seems that you are
from Washington, US .

Info/ Feedback on this

Show city and country
Show country only
Hide my location
Leave your comment here:
Please type in the code:
photo Add a picture:

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.