Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic menu: Conditional CCS use- directed by JS

Status
Not open for further replies.

kstargold

Programmer
Jun 7, 2004
27
US
Hi,

I have a table based menu as such:

Code:
<tr> 
  <td class="lglink" valign="top" width="1">&nbsp;</td>
  <td class="lglink" valign="top" width="13">
    <img src="images/ybullet.gif" width="10" height="10" border="0" vspace="3"></td>
  <td class="lglink" width="143"><a href="/knowit/staff.html">Staff</a></td>
</tr> 

<tr> 
  <td class="lglink" valign="top" width="1">&nbsp;</td>
  <td class="lglink" valign="top" width="13">
    <img src="images/ybullet.gif" width="10" height="10" border="0" vspace="3"></td>
  <td class="lglink" width="143"><a href="/knowit/press.html">Press</a></td>
</tr>

<tr> 
  <td class="lglink" valign="top" width="1">&nbsp;</td>
  <td class="lglink" valign="top" width="13">
    <img src="images/ybullet.gif" width="10" height="10" border="0" vspace="3"></td>
  <td class="lglink" width="143"><a href="/knowit/contact.html">Contact Us</a></td>
</tr>
I havn't shown the entire table, because it is seeded three deep and pretty complex.


This link table is in an include file. However I wanted to beable to change the links (from link to em or italic) depending on which page you were on.

I got around this by make 5 separate include files. But my list of links is growing, and they now have children.

----

I think I might beable to do it like this:
Code:
//CCS file
.current
	{
	font: italic;
	color: black;
	text-decoration: none;
	a:hover { color: #000000; } 
	}

Code:
<span class="current" id="Home"><a href="home.html">Home</a></span>

It would still be clickable, but that's fine.


My Question:
Is there a way that I can apply the css to only the the id that is specified by a JavaScript?
And how wirte a JS to base this on the page filename? (if you have some easy code to split out the file name, that would be great too...:))



Thank you SO MUCH, I couldn't do it without you guys (and ladies), you're the best.

Kstar
 
Is the code that you listed JavaScript?

Thanks,
Kstar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top