Jump to content

chnaging 2nd or 3rd link css depending on page


bleustreak12

Recommended Posts

i have a div which has an id in that i have a div which has a class name then i have a table in the second div and in that i have few links (ie. <a href=...</a>)

 

<div id="nav">

<ul>

<div class="moduletable_menu">

<table width="100%" cellspacing="1" cellpadding="0" border="0">

<tbody>

<tr>

<td nowrap="nowrap">

<a class="mainlevel" href="ssssssss">Home</a>

<a class="mainlevel" href="ssssssssd">About</a>

<a class="mainlevel" href="ddddddd">News2</a>

<a class="mainlevel" href="ddddddd">News21</a>

<a class="mainlevel" href="ddddddd">News4</a>

<a class="mainlevel" href="ddddddd">News4</a>

</td>

</tr>

</tbody>

</table>

</div>

</ul>

</div>

 

now i want to change the css of the link only on certain pages .

 

So i was thinking wheteher i could get the current url of the page and if it is the right one then the propertioes of the 2nd or 3rd  link change and if it is on another page  the 1st link should change

 

at any time i may require to chnage atleast one link

 

so i will require either javascript code which if on the right page selects the 2nd or third link to change and on another page the 1st link

 

 

How will i achieve this

 

can anybody please help me

 

 

 

 

Link to comment
Share on other sites

An easier way to do this is purely in CSS. Give the body on the pages you want to change the links a class. Ex:

 

<body class="link_changer">

 

Then you use:

 

.link_changer #nav table a
{
  //css here
}

 

Which will only change the links on the pages that have that class entered into the body.

 

But to be honest, you have some very invalid code there. You should validate it before proceeding or you will end up with much worse headaches in the future.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.