Yes and no button in javascript

Is it possible to have yes and no button in javascript confirm/alert popups and how?
Thanks,
Aneesh.
ganeshaneeshAsked:
Who is Participating?
 
sunithnairConnect With a Mentor Commented:
I dont think it is possible to have the buttons named as "Yes", "No" in the alert/confirm functions because the browsers does not allow to change the default dutton names.
0
 
TimCotteeConnect With a Mentor Head of Software ServicesCommented:
Hello ganeshaneesh,

Not necessarily with the standard dialogs. The button text is controlled by the browser/operating system itself and not by anything that you can control. You can however create a popup that can used to give you more control over what is displayed. These can be modal dialogs or where this is not supported can be made to simulate this.

Regards,

TimCottee
0
 
sunithnairConnect With a Mentor Commented:
You might want to try this link there are some tips in here http://www.experts-exchange.com/Web/Web_Languages/JavaScript/Q_21182622.html
0
 
fsze88Connect With a Mentor Commented:
hum.. two options
by window.showModalDialog or by vbscript execScript

reference of showModalDialog
https://developer.mozilla.org/en/DOM/window.showModalDialog
reference vbscript execScript
http://www.delphifaq.com/faq/javascript/f1172.shtml

note : vbscript execScript is only works on IE.... stated on vbscript reference url..
showModalDialog is works on IE,FF more complex than vbscript execScript
vbscript example
<script language=javascript>
 
/*@cc_on @*/
/*@if (@_win32 && @_jscript_version>=5)
 
function window.confirm(str)
{
    execScript('n = msgbox("'+str+'","4132")', "vbscript");
    return(n == 6);
}
 
@end @*/
var r = window.confirm("Can you do it?");
alert(r);
</script>
 
window.showModalDialog example
https://developer.mozilla.org/samples/domref/showModalDialog.html

Open in new window

0
 
dnunes_brConnect With a Mentor Commented:
The confirm and alert dialog boxes of standard javascript can't be changed. There are other ways you can show a custom window, but you will need to do it by yourself or use some third party javascrip library/framework, such as YUI, Dojo, Scriptaculous, JQuery, etc...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.