codetoad.com
Home||ASP|ASP.Net|C++/C#|DHTML|HTML|Java|Javascript|Perl|VB|XML||CodeToadPlus!||Forums||RAM
Search Site:
Search Forums:
Re: Change link style (color) based on current page (url) tgreer at 00:53 on Wednesday, February 02, 2005

Just apply an inline style. Cascading Style Sheets are so-called because they cascade.

So if an element has a style applied via a CLASS, but inline (via "style" tag") has the same style applied with a different value, the MOST SPECIFIC style will apply.

The answer then is to keep using classes, but in your various page load events, override the style of a particular link by using the JavaScript "element.style" syntax.

Thomas D. Greer
www.tgreer.com


Re: Change link style (color) based on current page (url) tgreer at 01:19 on Wednesday, February 02, 2005

<html>
<head>

<style type="text/css">

.lnkBlue { color: #00F;}

</style>

<script type="text/javascript">

function changeLink(x)
{
document.getElementById(x).style.color = "#F00";
}
</script>
</head>

<body onload="changeLink('redLink');">

<a id="blueLink" class="lnkBlue">Blue</a>

<br/>

<a id="redLink" class="lnkBlue">Red</a>

</body>
</html>


Re: Change link style (color) based on current page (url) tgreer at 14:43 on Wednesday, February 02, 2005

You're welcome. Just a reminder: CodeToad is advertiser-supported, as is www.tgreer.com. There are some CSS articles there, as well.









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
Latest crack software ftp download
Famous Software ftp download 2013
deleting data from databse to dropdown list
matrix addition
Re: Storing data from HTML to Excel or TXT
Re: function within loop problem
Re: Ô‡´ò¥¯¥é¥Ö¤Ï ¥Æ©`¥é©`¥á¥¤¥É£ò£±£±¥¢¥¤¥¢¥ó ¤Î£··¬ ¤Ç¤¹
Re: Replace
Re: タイトリスト AP2アイアン 712�情�


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


Copyright codetoad.com 2001-2013