Re: OT- javascript question removing style settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday 10 Oct 2005 19:53, peter kostov wrote:
> On Mon, 2005-10-10 at 11:46 -0700, Don Russell wrote:
> > I'm running out of technical resources... I can't find an answer on
> > google, and my O'Reilley's JavaScript book doesn't have the answer
> > either... :-(
> >
> > I can set a background color of an element like this:
> >
> > this.style.backgroundColor='red';
> >
> > but how can I *remove* that style? Obviously I can change it to a
> > different color, I want to actually remove the style setting altogether.
> >
> > this.style.removeProperty('backgroundColor');
> >
> > did not have the desired effect... no change, but no javascript error in
> > the javascript console either (firefox 1.0.7)
> >
> > Any ideas on how to *remove" a style setting... or is there a "special"
> > color like transparent?
> >
> > this.style.backgroundColor='transparent';
>
> Yes, in CSS specification there is 'background-color: transparent;`
> see:http://www.w3schools.com/css/pr_background-color.asp
> But I dont know if it works with javascript. It should, I think.

This would work, but you'd still be overriding the stylesheet, not clearing 
the style property of the element.

-- 
Jim


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux