tags:

views:

2143

answers:

4

I could only find the function confirm() that gives OK/Cancel buttons. Is there any way to give Yes/No buttons?

+2  A: 

No.

Instead you could use a in browser modal popup.

FlySwat
+5  A: 

Javascript offers 3 modal boxes. Prompt, confirm and alert. None of those satisfy your request.

There are a plethora of js modal popup solutions. Here's an example.

Cade
+1  A: 

No, but there are JavaScript libraries that can accomplish this for you. Just as an example, Ext JS can be used to create a message box dialog.

ejack
A: 

Like everyone else above says, you're stuck with OK/Cancel using confirm().

I would like to recommend this jQuery plugin though: jqModal. I've used it on 3 recent projects and it has worked great for each one. Specifically check out this example:

6). FUN! Overrides -- a. view (alert), b. view (confirm) It is now time to show a real-world use for jqModal -- overriding the standard alert() and confirm dialogs! Note; due to the single threaded nature of javascript, the confirm() function must be passed a callback -- it does NOT return true/false.

travis