set focus on the button

P

pruszkor

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
 
M

marss

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?" :)
 
P

pruszkor

marss said:
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?" :)

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
 
R

Randy Webb

(e-mail address removed) said the following on 6/8/2006 8:41 AM:
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?

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.
 
B

Bart Van der Donck

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?

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,
 
B

Bart Van der Donck

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

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,795
Messages
2,569,644
Members
45,356
Latest member
deepthi.kodakandla

Latest Threads

Top