Note: When a prompt box pops up, the user will have to click either "OK" or "Cancel" to proceed after entering an input value. Do not overuse this method, as it prevents the user from accessing other parts of the page until the box is closed. The prompt method returns the input value if the user clicks "OK".
If the user clicks "cancel" the method returns null. Using the switch statement together with prompt to execute a block of code based on user input:.
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:. How are you today? Martini is good for your soul. Are you sure the Cosmopolitan is your favorite? HOW TO. Your message has been sent to W3Schools. W3Schools is optimized for learning, testing, and training. Examples might be simplified to improve reading and basic understanding. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content.
All Rights Reserved. Powered by W3. A String. If the user clicks "OK", the input value is returned. If the user clicks "cancel", null is returned.
If the user clicks OK without entering any text, an empty string is returned.Last post May 15, AM by gtes. This will be used to confirm delete on records from a DB. Basically, this should be a simple pop-up that'll contain a text field, an OK and Cancel buttons.
I'd like to then be able to then get the user input back so I could make the validation. If you are looking for a confirmation box for some user action, following sample code may be helpful to you. Here in the OnClientClick of a button am showing a confirmation pop up, if the user click Yes it will execute the server side code, otherwise the form will not post to server.
The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.
Learn more. How to write a popup window to pass the password to main window? Ask Question. Asked 6 years, 9 months ago. Active 6 years, 9 months ago. Viewed 16k times. Thanks a lot. If you are appending password to query string then it's not really a password. Besides, prompt is not meant for what you are trying to do. Active Oldest Votes.
Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. The Overflow How many jobs can be done at home? Featured on Meta. Community and Moderator guidelines for escalating issues via new response…. Feedback on Q2 Community Roadmap. Technical site integration observational experiment live on Stack Overflow.
The option you are talking about is very good for customizing the look and feel of the box we are to push to the user.
However, there are many problems associated with pop-up windows. Two of them which may call the usability of this particular situation into question are:.
Most modern browsers block pop-up windows unless the user allows them to pop up. Some careless users may actually ignore browser messages and never see the box. So, they may go behind other windows and simply be ignored.
Yes I think several modal windows on the page you mentioned can be used to serve this purpose. Dear forum admin, thank you very much for your fast reply. Two of them which may call the usability of this particular situation into question are: Most modern browsers block pop-up windows unless the user allows them to pop up.
Thank you very much.The window. When a confirm box pops up, the user will have to click either "OK" or "Cancel" to proceed. If the user clicks "OK", the box returns true. If the user clicks "Cancel", the box returns false. 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.
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:. Example alert "I am an alert box! Example if confirm "Press a button!
Subscribe to RSS
How are you today? HOW TO. Your message has been sent to W3Schools. W3Schools is optimized for learning, testing, and training.
Powered by W3.A Developer. An Eweek. Closing the Tag! Thanks sgt for replying. I think I didn't make it clear. Click OK to enter! Ah Ok now I understand what you want to do! Open a JS Prompt that is supposed to act like an Inbox with type set to password. I am sorry, I dont know of a way to do this!
Why dont you just create a form where a user can enter Username and Password. Looks better imho. Sorry for not being more of a help here!
You cannot do that. Originally Posted by mendhak You cannot do that. So what are the other way of prompting an input box to ask password? Im sorry for stupidity, I'm very new at this thing.
It's not possible. End of discussion. Make a page that prompts for a password not in a popup. Submit the page to the server.
All the buzzt CornedBee "Writing specifications is like writing a novel. Writing code is like writing poetry. If you do PM me, I will not answer your question. Originally Posted by CornedBee It's not possible.
Thanks for the good advice CornedBee. I think I just make a page that ask password and not pop up. NET VB.