473,406 Members | 2,356 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,406 software developers and data experts.

Proper use of "! important"

Hello,

I want to change the style of a link (<a>) when the page finishes
loading. This would be a trivial problem, except the link already has
a style defined. I think I've solved the problem, but I want to get
some feedback on my solution.

The CSS, JavaScript, and HTML is essentially this:

// JAVASCRIPT
function changeStyle()
{
document.getElementById("linkB").className="blueCl ass";
}

// CSS
div.redClass a
{ color:#FF0000; }

a.blueClass
{color:#0000BB ! important; }

// HTML
<BODY onLoad="changeStyle();">
<div class="redClass">
<a id="linkA" href="xyz.com">Link A (Red)</a><br>
<a id="linkB" href="xyz.com">Link B (Blue)</a>
</div>
</BODY>

So, you can see that both links will intially be red, but one will
quickly get changed to blue via the onLoad event that changes the
anchor tag's class. This does NOT work if I leave out "! important"
text for the blueClass attributes. Is there a better way to override
the redClass?

Thanks.
Jul 20 '05 #1
0 7486

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

Similar topics

40
by: Steve Juranich | last post by:
I know that this topic has the potential for blowing up in my face, but I can't help asking. I've been using Python since 1.5.1, so I'm not what you'd call a "n00b". I dutifully evangelize on the...
1
by: Rick Brown | last post by:
I'm trying to scan a barcode that contains the text string "BPWOT08762" into a textbox for use in a DLookup or query grid. I want to look thru a table's field that contains the last 6 characters...
10
by: LaEisem | last post by:
On-the-job, I have "inherited" a lot of old C language software. A question or two about when "casting" of null pointer constants is needed has occurred during behind-the-scenes cleanup of some...
1
by: Bill Woodruff | last post by:
As an exercise I wrote a small C# program to download several hundred text files of guitar tab music by parsing the home page of the site and retrieving all the links to the music text files and...
1
by: seanick | last post by:
I am trying to locate an installed application, and I so far have been unable to do so programattically. There does not appear to be a way to do so directly from the .NET framework, either 1.1 or...
5
by: David Freeman | last post by:
Hi There! I'm using ASP.NET 1.1 and VB. Below is my DataGrid declaration... <asp:DataGrid id="myDataGrid" runat="server" AutoGenerateColumns="false"
7
by: Erik Funkenbusch | last post by:
I've been thinking about different ways to address this problem, and I figured i'd just toss this out and see if anyone has a good solution. I've got database field of type char(1), this field...
1
by: MJR | last post by:
Could anyone please help me change data in uppercase to data in propercase in MS Access?
169
by: JohnQ | last post by:
(The "C++ Grammer" thread in comp.lang.c++.moderated prompted this post). It would be more than a little bit nice if C++ was much "cleaner" (less complex) so that it wasn't a major world wide...
0
by: Russell Warren | last post by:
I'm running python 2.5.1 and it seems that SimpleXmlRpcServer is not setup to support the base datetime module in the same way xmlrpclib has been with "use_datetime". I see that someone (Virgil...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.