From: leosarasua on
I am writing a page in French and I need to create a confirm box, but
I want to change the labels of the buttons from "OK" and "Cancel" into
"Oui" and "Non".

I've looked around and it seems impossible to do this, so my question
is: why is the confirm method so restrictive? All it needs is a
question string and two labels for the true and false buttons. Why was
it defined with only one parameter, instead of, let's say one
mandatory and two optional parameters? If there is no reason, then
would it be possible to request a modification to the Javascript
standard? If two optional parameters are added, it would still be
backward compatible, and it would make life easier to those who, like
me, need to write code in other languages.

Please comments.
From: Evertjan. on
wrote on 02 dec 2007 in comp.lang.javascript:

> I am writing a page in French and I need to create a confirm box, but
> I want to change the labels of the buttons from "OK" and "Cancel" into
> "Oui" and "Non".
>
> I've looked around and it seems impossible to do this, so my question
> is: why is the confirm method so restrictive? All it needs is a
> question string and two labels for the true and false buttons. Why was
> it defined with only one parameter, instead of, let's say one
> mandatory and two optional parameters? If there is no reason, then
> would it be possible to request a modification to the Javascript
> standard? If two optional parameters are added, it would still be
> backward compatible, and it would make life easier to those who, like
> me, need to write code in other languages.

Confirm() is a browser specific function,
not part of the Javascript specs, methinks.

This Q seems to pop up every week or so.

Please read the FAQ and the archive.

<http://www.jibbering.com/faq/#FAQ4_28>


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
From: Randy Webb on
leosarasua(a)gmail.com said the following on 12/2/2007 3:11 PM:
> I am writing a page in French and I need to create a confirm box, but
> I want to change the labels of the buttons from "OK" and "Cancel" into
> "Oui" and "Non".

You will have to write your own "in window" confirm box if you want to
have any control at all over what the wording is.

It could be nothing more than a simple div element with a textbox for
input and two buttons to click on.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
From: Thomas 'PointedEars' Lahn on
leosarasua(a)gmail.com wrote:
> I am writing a page in French and I need to create a confirm box, but I
> want to change the labels of the buttons from "OK" and "Cancel" into
> "Oui" and "Non".

It will be most certainly be "Oui" and "Non" in a French user agent (UA) by
default.

> [...] If there is no reason, then would it be possible to request a
> modification to the Javascript standard?

No. You don't understand that the alert() method has not been part of the
JavaScript language long since, or any other ECMAScript implementation for
that matter. It is part of the DOM, an API provided by the UA, which can be
used with ECMAScript-binded interfaces.

See http://PointedEars.de/es-matrix (updated).


PointedEars
--
"Use any version of Microsoft Frontpage to create your site. (This won't
prevent people from viewing your source, but no one will want to steal it.)"
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
From: VK on
On Dec 2, 11:34 pm, Randy Webb <HikksNotAtH...(a)aol.com> wrote:
> You will have to write your own "in window" confirm box if you want to
> have any control at all over what the wording is.
>
> It could be nothing more than a simple div element with a textbox for
> input and two buttons to click on.

Right - and the modality option? ;-) This question is really a FAQ but
this post stays aside because it is not so much about "how?" but "why
not implemented?" - and the fair answer would be "nobody knows". For
IE it never was a problem because first anyone could bridge JScript to
VBScript MsgBox where the prehistoric limitation in question did not
exist. After window.showModalDialog it really was not a problem at
all. Lucky other are starting to pick up to the current demand, say
upcoming Firefox will have showModalDialog as well:
http://developer.mozilla.org/en/docs/DOM:window.showModalDialog

For the time being one can use different pseudo-modal emulations. Out
of 5sec search for instance:
http://slayeroffice.com/code/custom_alert/
http://javascript.about.com/b/2007/09/28/modal-dialog-box.htm