How to apply style to a confirm pop-up window - javascript

is it possible to give style to a confirm dialog box in javascript?
i am using asp.net with c#.
Eg:-
OnClientClick='javascript:return confirm("Are you sure, Do you really want to delete this item ")'
how to give style for this dialog box?

The regular alert and confirm boxes are based on the window style currently applied to the operating system.
There are replacements available though for the alert and confirm boxes. There are more than this one if you search for it.

If you can use jQuery then take a look at
jQuery Alert Dialogs (Alert, Confirm, & Prompt Replacements)
and
Confirm Override

Related

Is it possible to give image instead of alert box?

I'm using alert() for javascript and would like to provide an image, i.e. alert(img); - where img is a variable for an image url.
You need to use custom alert box. By default it is not possible.
For example you could look at http://bootboxjs.com which allow to show nice alert with Bootstrap style
The alert box is a system object, and not subject to CSS. To do this style of thing you would need to create an HTML element and mimic the alert() functionality. The jQuery UI Modal box does a lot of the work for you, see here

Creating a custom style for Javascript's Confirm Function

Is it possible to custom style the javascript's "Confirm Function" dialog box, instead of using the the default look and feel that is provided by the browser? If not is there an alternative solution to this?
if you want to custom look for confirm box , you need to use jalert javascript for that.
check link below hope it will help you.
http://labs.abeautifulsite.net/archived/jquery-alerts/demo/
you can not style javascript "confirm function" dialog box because its default option if you want to do the same then you have to create your own dialog box with the help of Javascript/jQuery and CSS
E.g. http://demos.9lessons.info/alert_delete.html

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.

Looking for particular alert box behavior

I'm interested in alert boxes such as,
http://www.visual-blast.com/javascript/nice-alert-box-with-jquery-impromptu/
and
http://woork.blogspot.com/2008/08/design-stunning-alert-box-using.html
but with a different functionality, the user should be able to interact with the page even with the alert box present, so it needs to be movable and not obscure the underlying page, as in this example,
http://www.open-lab.com/mb.ideas/index.html
Alert box should be generated automatically on page view plus the title and message of the alert box should change with each page refresh from expandable library.
Is there anything out there like this?
Thanks
Sounds like the jQuery UI dialog widget might do what you need?
http://jqueryui.com/demos/dialog/
Here is an example with mootools. You easily can extend any element on the page to be draggable. You may use this plugin as a sample of alerts and you'll just need to remove some functionality and add make it draggable.
There are few custom dialogs in moo.rd. One of them is the Custom.Alert:
http://www.moord.it/examples/custom_alert

Is it possible to get Message Box in web forms?

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.

Categories