472,090 Members | 1,267 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Highlighting one field with focus on another

Hi,

I was wondering if there is any way with onload that I can highlight (blue
color) the select box field while simultaneously placing the mouse cursor or
focus on a text box immediately below it? Thanks in advance.

-Stu
Jul 20 '05 #1
2 1556
On Thu, 1 Jan 2004 23:01:40 -0500, Stuart Wexler <St*******@comcast.net>
wrote:
I was wondering if there is any way with onload that I can highlight
(blue color) the select box field while simultaneously placing the
mouse cursor or focus on a text box immediately below it? Thanks in
advance.


I think the problem you'll have here is that the highlight will be removed
when the control loses focus. I think Opera keeps it, but the highlight
colour changes from blue to grey. I fairly sure that IE removes the
highlight completely until focus is returned to the control. I haven't
used Mozilla and Netscape enough to remember their behaviour.

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #2
>I was wondering if there is any way with onload that I can highlight (blue
color) the select box field while simultaneously placing the mouse cursor or
focus on a text box immediately below it? Thanks in advance.


While possible, you will need to add more functionality to remove
the highlight from the first option if a person selects another option.
This is just a simple example to do what you asked for.

<.script type="text/javascript">
function initHighlight( objForm) {
objForm.elements[ "exaSelect"].options[ 0].style.color="white";
objForm.elements[ "exaSelect"].options[
0].style.backgroundColor="highlight";
objForm.elements[ "exaInput"].focus();
}
<./script>

<.body onload="initHighlight( document.forms[ 'frmExample']);">

<.form name="frmExample" onsubmit="return false;">
<.select name="exaSelect">
<.option value="1">1
<.option value="2">2
<.option value="3">3
<./select>
<.input type="text" name="exaInput" value="This is a test">
<./form>

Peace, Vm
Yaz

Providing complicated solutions to simple problems since 1997.
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Geoff | last post: by
1 post views Thread by Tony Johnson | last post: by
1 post views Thread by Adrian Parker | last post: by
1 post views Thread by Will_uk | last post: by
2 posts views Thread by donpro | last post: by
reply views Thread by leo001 | last post: by

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.