Is there a way to open a message box and have Yes return turn and No return false? I know about the confirm but the user really wants Yes/No. It really needs to be javascript also.
jags22, it's not possible to alter the button verbage on a confirm box. The closest you can come is by creating your own div popup box with custom HTML buttons. But that has the problem of not being modal (i.e. - you can still click the other buttons on the page) If an IE only option works for you, then you may want to consider using IE's javascript function showModalDialog which has 2 downfalls - 1. as I pointed out, it's IE only and 2. the popup box comes with an X button in the upper right corner so the user can close it w/o even clicking either of your buttons.
The best solution would be to convince your employer that OK/Cancel is the only option. You could add a message to the bottom of your confirm like "Click OK for Yes and Cancel for No".
Here's another possible solution. Like Kaht said, how about making your own "pop-up" using a div tag with a border and 2 buttons that say yes or no (give them class="pop_up" or whatever class name you choose).
Kaht also mentioned that it's not modal so, yes, the user could still hit other buttons unless you create a function to temporarily remove them (not disable them, because onclick will still work on a disabled button).
function modalBox(exceptionClass,isModal)
{
var input=document.getElementsByTagName("input");
var i;
for (i=0; i<input.length; i++)
{
if (input.className!=exceptionClass)
{
if (isModal)
{
input.style.visibility="hidden";
}
else
{
input.style.visibility="visible";
}
}
}// end for i
}// end modalBox
The idea would be to call modalBox("pop_up",true) when you're displaying and then call modalBox("pop_up",false) when the user has clicked the yes/no option.
Sorry if it's a bit rough around the edges. Came up with it on the fly and am not looking for potential pitfalls with the design.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.