473,394 Members | 1,640 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

set focus on the button

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

Jun 7 '06 #1
5 7952
> 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?" :)

Jun 8 '06 #2

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


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

Jun 8 '06 #3
pr******@aecl.ca said the following on 6/8/2006 8:41 AM:
marss wrote:
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?" :)


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.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 8 '06 #4
pr******@aecl.ca wrote:
marss wrote:
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?" :)


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,

--
Bart

Jun 9 '06 #5
Bart Van der Donck wrote:
[...]
<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>

--
Bart

Jun 9 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: TSK | last post by:
I cannot get my focus() fn to work in my validateInput(userInput) fn. It will not allow the user to go back and correct invalid input like it should. Instead it goes right on through with the...
4
by: Scott Navarre | last post by:
Hi, I have Red Hat 8.0 and have the default Mozilla browser that comes with it. I am programming in javascript and have come across something problematic. Given the following code: <HTML>...
7
by: selen | last post by:
I am using above script for Focus to txtAdi which is textbox in c# web application.But it doesnt work. Have you any idea why it doesnt work thanks....... char c=(char)34;
0
by: Steve Bezner | last post by:
I have an issue in which a link label on a windows form does not draw the focus rectangle if you programmatically force it to have focus via the Control.Focus() method. To duplicate, create...
1
by: melanieab | last post by:
Hi again, With much help, I've finally gotten the Tab key to be recognized when a textbox is in focus, but now I'm having trouble with the up/down keys when they're focused on a custom button (on...
4
by: PK9 | last post by:
I have a button at the top of my page that I have an onClick event handler for which makes some new controls (at the bottom of my page) visible. When the user clicks the button I make the new...
18
by: Euphor2 | last post by:
I'm in school, taking a VB .NET 2003 course, and the teacher taught us how to use Sender.Focus() to return focus to the control from which focus was received. However, when I got home, and tried...
3
by: Brian Henry | last post by:
Hi, I have a bunch of forms in a DLL that I call from my main application. The one form is a login form, and I have the tab order set in the order I want it (password box first, then ok button...
16
by: Stuart | last post by:
I have a page where I utilise the left and right cursor keys to change an image, also on this page is a groups of radio buttons, unfortunately when a radio button is clicked the focus for the...
1
by: john ciriello | last post by:
I created a form and put a button and a label on it. I set the tabstops to false. When I first run it I can click the button and there is no focus rectangle. Which is what I want. However, if I...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.