Is it possible to get Message Box in web forms? - javascript

I tried but I guess Message Box only works with win forms. What is the best alternative to use in web forms?

You can use confirm for yes/no questions and alert for "OK" messages in JavaScript.
The other alternative is to use JavaScript to pop up a new window that looks and acts like a message box. Modality in this case varied by browser. In Internet Explorer, the method
window.showModalDialog(url,name,params)
will display a modal dialog. The Mozilla approach is to still use
window.open(url,name,params)
but add modal=yes to the params list.

result = confirm('Yes or no question here.')

JavaScript:
alert("This box has an OK button.");

The Ajax ModalPopup also works nicely. Here is an example:
http://www.asp.net/ajax/ajaxcontroltoolkit/samples/modalpopup/modalpopup.aspx

You have dojo dialog widget: http://www.dojotoolkit.org/ and you can use it as a message box.

Related

prevent this page from creating additional dialogs

I am currently working on project and i have requirement to use java script input dialog to take input from user
see example
now i want to remove this check box which says that prevent this page from creating additional dailogs
how i can remove this message from alert box
You cant remove because it's introduced by browser.
To solve you problem try to employ http://bootboxjs.com/, whit this library you ca do the same by writing:
bootbox.prompt("Enter password please", function(result) {
// do something whit result
});
You can't remove this as it's a browser security feature. You should probably look at other ways of presenting your dialog - use a modal window instead for example.
So what you want to do it's IMPOSSIBLE. Since it's a browser functionality.
Anyway I advice you to use a Model-Box.
You will:
- Prevent that from happen
- Beautify your website.
You may want to check this: http://www.fallr.net/ I've used it's pretty cool and easy. Tou have the PROMPT-LIKE example wich returns you something written by the user. You can also have a CALLBACK to some AJAX function for example.
So you can't remove it make that clear for you at least for now.
Dont use alert system boxes they are ugly.. really..
Hope it helped!
i fount the answer
We have two different things going on here...
I'm suggesting adding a preference to about:config (or user.js in your
profile folder).
Copy the preference name dom.successive_dialog_time_limit Open
about:config Right-click in the preferences area and choose New >
Integer Paste the preference name and click OK Then enter 0 and click
OK
for more details chek this link
Prevent this page from creating addtional dialogs

Custom Confirm Form by jQuery

Now I use return confirm(Message); when need confirmation in a form. that cause displaye a form with two button OK and Cancel. Is there any way to change the buttons text in displayed form? I need to change buttons to another language? what is your suggestion?
Since you tagged jquery, jQuery UI Modal Confirm is definitely worth a look
Working fiddle: http://jsfiddle.net/naveen/GR2UT/
You can't change the button text on a native confirm box. You can program your own modal dialog, which would give you control to what's in the buttons. In this jsfiddle you'll find a plain javascript example. Or use JQuery, like naveen suggested.

How to show confirm box like StackOverflow's confirmation box?

Ask a question, and while editing the body of your question, click on some link on the page. StackOverflow's script knows that you are not finished yet, and warns you about loosing your unsaved data. However, it's confirmation box is not a jQuery plugin, or anything like that. It seems that its confirmation box is browser-specific box, something like JavaScript's confirm box. To prove it, simply check it in many browsers and you see different UI styles.
How they've done it? Which JavaScript command?
The onbeforeunload Javascript event is what you're looking for.
Trying setting a global flag to know when the page is "editing" and then use the onbeforeunload event
window.onbeforeunload = function(){ return globalEditingFlag ? 'You are editing': null }
Look at this :
http://www.w3schools.com/js/js_popup.asp
The section about the confirm box

'Yes', 'No', and Cancel with JavaScript confirm function

I am familiar with the basic JavaScript confirm function. I want to take one step further: instead of having a message box pop up with the options of "OK" and "Cancel", I would like to add three options and change the dialog so that the three choices read "Confirm", "Deny", and "cancel". A "Confirm" or "Deny" choice would each call a different function. Any suggestions on how to do this?
I am not using JQuery or any other library, and i really don't want to use any if I can help it, as it's just this one function. Any help would be appreciated.
You will want to look into making a custom dialog from a div, and assign click events to the buttons. You can't modify the browser's standard dialogs without using VBScript which is IE only.
The fact that you don't want to use JQuery is quite silly. It's 31k and the best thing to ever happen to JavaScript.
If you want to avoid JQueryUI, you can create a dialog yourself very easily. Here's a tutorial to get you started: http://www.queness.com/post/1696/create-a-beautiful-looking-custom-dialog-box-with-jquery-and-css3
AFAIK, you cannot change the button prompt strings with just using pure JS. It has to be 'OK' and 'Cancel'.

javascript prompt for password (i.e. *******)

I'm writing a bookmarklet and I need to be able to prompt the user for a "password". However, I don't want it to be in clear text on screen, so I cannot use prompt.
Is there a masked alternative to prompt()?
Any other suggestion?
You can create a floating div on the current page, with a form containing a password field.
alternative: let the bookmarlet point to a particular web page. Get the password from the user on that page, and continue.
This solution does not use javascript at all, as you may have noticed. If you really insist on using javascript, you will have to create a new window using javascript (window.open), add form and input elements to it, and set the form's submit value to your web app backend.
you can of course, display a dialog box on the current page, but that will be pretty irritating to the user. Be warned.
jrh
there isn't one - try looking into Thickbox on a modal setting like this:
Open iFrame Modal
The easy, fast answer: No, there are no cross browser method like window.prompt() that masks the user input. There are however some proprietary stuff you could look into. In MSIE you got window.createPopup(), window.showModalDialog() and window.showModelessDialog(). However I donĀ“t reccomend using this approach =P
What would happen if you used http authentication for your destination? Would the UA prompt the user with a un/pw?

Categories