Connecting Tech Pros Worldwide Forums | Help | Site Map

set focus on the button

pruszkor@aecl.ca
Guest
 
Posts: n/a
#1: Jun 7 '06
Hello,

This a question from a javascript n00b: I would like to display a
confirmation box using confirm() method BUT is it possible to change
the default focus on it from OK button to Cancel button? Or should I
use something else? What then?

Thanks

Roman

marss
Guest
 
Posts: n/a
#2: Jun 8 '06

re: set focus on the button


> Or should I use something else? What then?

Restate confirmation message in a different way.
E.g.: Instead of "Are you sure you want to quit?" ask "Do you really
wish to stay?" :)

pruszkor@aecl.ca
Guest
 
Posts: n/a
#3: Jun 8 '06

re: set focus on the button



marss wrote:[color=blue][color=green]
> > Or should I use something else? What then?[/color]
>
> Restate confirmation message in a different way.
> E.g.: Instead of "Are you sure you want to quit?" ask "Do you really
> wish to stay?" :)[/color]

Clever :-)

Unfortunately the message is WAY more complicated than this, the stakes
are REALLY high and the users are compulsive clicking morons.

Any better ideas?

R

Randy Webb
Guest
 
Posts: n/a
#4: Jun 8 '06

re: set focus on the button


pruszkor@aecl.ca said the following on 6/8/2006 8:41 AM:[color=blue]
> marss wrote:[color=green][color=darkred]
>>> Or should I use something else? What then?[/color]
>> Restate confirmation message in a different way.
>> E.g.: Instead of "Are you sure you want to quit?" ask "Do you really
>> wish to stay?" :)[/color]
>
> Clever :-)
>
> Unfortunately the message is WAY more complicated than this, the stakes
> are REALLY high and the users are compulsive clicking morons.
>
> Any better ideas?[/color]

You can't change the order nor which is focused in a confirm box. If you
want something different, then you will have to roll your own with a
form input with buttons. Then you can focus whatever you like.

Or, let your "compulsive clicking morons" learn the hard way to pay
attention to what they are doing.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Bart Van der Donck
Guest
 
Posts: n/a
#5: Jun 9 '06

re: set focus on the button


pruszkor@aecl.ca wrote:
[color=blue]
> marss wrote:[color=green][color=darkred]
> > > Or should I use something else? What then?[/color]
> >
> > Restate confirmation message in a different way.
> > E.g.: Instead of "Are you sure you want to quit?" ask "Do you really
> > wish to stay?" :)[/color]
>
> Clever :-)
>
> Unfortunately the message is WAY more complicated than this, the stakes
> are REALLY high and the users are compulsive clicking morons.
>
> Any better ideas?[/color]

For Microsoft Internet Explorer:

<script language="vbscript" type="text/vbscript">
dim R
R = MsgBox("Are you sure ?", vbYesNo, "Please confirm")
</script>

Variant:

<script language="vbscript" type="text/vbscript">
dim R
R = MsgBox("REALLY sure ??", vbYesNo + vbCritical, "Warning!!!")
</script>

Hope this helps,

--
Bart

Bart Van der Donck
Guest
 
Posts: n/a
#6: Jun 9 '06

re: set focus on the button


Bart Van der Donck wrote:
[color=blue]
> [...]
> <script language="vbscript" type="text/vbscript">
> dim R
> R = MsgBox("Are you sure ?", vbYesNo, "Please confirm")
> </script>[/color]

Oops I forgot the most essential part. The code should be:

<script language="vbscript" type="text/vbscript">
dim R
R = MsgBox("Sure?", vbYesNo+VBDefaultButton2, "Please confirm")
</script>

--
Bart

Closed Thread