DelphiFAQ Home Search:

Have a Javascript popup display Yes/ No instead of Confirm/ Cancel


comments64 comments. Current rating: 4 stars (22 votes). Leave comments and/ or rate it.


I need to ask my web site's user a Yes/ No question. Currently I use JavaScript's confirm() function.
The return value is true (OK) or false (CANCEL).
The word CANCEL is misleading. I want to have the buttons say Yes/ No instead.
How can I do it?


Many people will tell you it is not possible, and that is true for standard Javascript.

However, I found the following which works at least in 32 bit Windows with IE (which often accounts for 95% of your site's users).

This solution uses vbscript's confirm() function.

No, it does not work in FireFox. FireFox will display Confirm/ Cancel.

<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 = confirm("Can you do it?");

Content-type: text/html


You are on page 5 of 5, other pages: 1 2 3 4 [5]
2017-11-27, 19:37:20
anonymous from Indonesia  
Kami sekelurga mengucapkan banyak trimah kasih kpada AKI NUGROHO atas bantuanya no 4d (3569) benar2 tembus 100% bila mau bukti hubungi AKI NUGROHO di nmr ini ;0821=9802=3183; Trma ksh.............

You are on page 5 of 5, other pages: 1 2 3 4 [5]



NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: