View Full Version : Defaulting to the cancel button

01-07-2004, 11:06 AM
In javascript is it possible to default to the cancel button in a confirm prompt box e.g:

var ans = confirm("Are you sure you would like to delete this file?");
if (ans)
return true;
return false;

It seems to always default to the 'OK' button.

Any help with this would be most appreciated.

Many Regards,
Ben Chivers

01-07-2004, 11:20 AM
No, as far as I know, you can not change the default OK in confirm because always the implicit boolean affirmative entrance (to use it in an if statement) must be unique and was implemented to be OK.

Yet, you may build a graphic a-like layer which can have a Cancel button focused if you badly need something similar...