By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,712 Members | 2,116 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,712 IT Pros & Developers. It's quick & easy.

Highlighting one field with focus on another

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
>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.