[thelist] [SPAM] DOM dummy needs help
Anthony Baratta
anthony at baratta.com
Tue Apr 18 10:41:14 CDT 2006
-----Original message-----
From: "Michael Pack" michaelpack at wvdhhr.org
Date: Tue, 18 Apr 2006 07:04:34 -0700
To: thelist at lists.evolt.org
Subject: [SPAM] [thelist] DOM dummy needs help
> Hi all, I'm a DOM dummy and the Microsoft lack of support for CSS
> psuedo:focus is forcing me to turn to javascript. I'm working on an UI
> which will contain alot of forms. I'm wanting to increase usability by
> highlighting the inputs, select, and textarea. I'm looking for
> suggestions.
>
> I've been working with...
>
> function changeColor(color)
> {
> document.getElementById('name').style.background=color
> }
>
> then using onfocus="changeColor('#FFFFCC')"
> onblur="changeColor('#FFFFFF')" within the form elements. THis works
> fine but the values of id and name attributes will be unique. I would
> have to keep building and building the function.
Why not pass the element into the function call?
e.g.
onfocus='changeColor(this,onColor);'
onblur='changeColor(this,offColor);'
Then in your JS code:
onColor = '#FFFFCC';
offColor = '#FFFFFF';
changeColor(oElement, sColor)
{
oElement.style.background=sColor;
}
This hasn't been tested, but should work or be pretty close.
More information about the thelist
mailing list