By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,341 Members | 1,726 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,341 IT Pros & Developers. It's quick & easy.

Get values from user in javascript

P: 1
Hi, i want to know how to get values from user in javascript like in c++ we use the statement cin.get but it is not used please tell me how we get values from the user.plz explain it with suitable example and reply quickly.
Nov 1 '07 #1
Share this Question
Share on Google+
2 Replies


acoder
Expert Mod 15k+
P: 16,027
Use the prompt() method.

PS. changed the thread title to better describe the problem.
Nov 1 '07 #2

100+
P: 428
In a webpage you can get user input from about everything.
Every element on the page can have event handlers for mouse and keyboard events.
You can use input elements and select menus and textareas to collect input from the user.
And you can use the window dialogs, confirm and prompt.

var username=window.prompt('Your name",'');
Nov 1 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.