Yes and no button in javascript

Is it possible to have yes and no button in javascript confirm/alert popups and how?
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.
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.


sunithnairConnect With a Mentor Commented:
You might want to try this link there are some tips in here
fsze88Connect With a Mentor Commented:
hum.. two options
by window.showModalDialog or by vbscript execScript

reference of showModalDialog
reference vbscript execScript

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?");
window.showModalDialog example

Open in new window

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...
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.