Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Changing how a link looks depending on the page.
Old 11-25-2008, 02:55 AM Changing how a link looks depending on the page.
Registered User

Posts: 78
Name: Joseph
Location: Texas
Trades: 0
This is kinda like css html and php but here it goes.

How can you change what a link looks like on a certain page?

I have a nav that looks like tabs and i want to make it so whichever page you are on the tab is down?!

wefuze.com

I have the stylle stuff but how do i do it?

Because i am using includes for that part.

if it were html it would be easy.
josephcohen is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-25-2008, 03:08 AM Re: Changing how a link looks depending on the page.
Experienced Talker

Posts: 32
Name: Dan
Location: New Zealand
Trades: 0
Use PHP to print out the navigation (Looping through an array using foreach), then print out CSS classes for each HTML DIV element whether "tab" or "tab_active" where tab_active has a different CSS style to have the tab down. Hope this helps.
Rumadon is offline
Reply With Quote
View Public Profile Visit Rumadon's homepage!
 
Old 11-25-2008, 03:09 AM Re: Changing how a link looks depending on the page.
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
use server side code to set a class to whichever is the "active" link for the page
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-25-2008, 03:07 PM Re: Changing how a link looks depending on the page.
Registered User

Posts: 78
Name: Joseph
Location: Texas
Trades: 0
Quote:
Originally Posted by chrishirst View Post
use server side code to set a class to whichever is the "active" link for the page
Awesome! So ill make the active links the same as the hover which is the tab down.

perfect! Thank you!
josephcohen is offline
Reply With Quote
View Public Profile
 
Old 11-25-2008, 03:24 PM Re: Changing how a link looks depending on the page.
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Or, if you're like me (I'm super lazy), you will do it all with JavaScript. This is for a navigation with an id of "menu" on it:

Code:
<script type="text/javascript">
var nav=document.getElementById("menu").getElementsByTagName("a");
for(var i in nav) {
    if(nav[i].href==window.location) {
        nav[i].className="active";
    }
}
</script>
If the href of a link is the same as the location of the window within "#menu", it will add a class of "active" to the <a>, which can be styled from the CSS document. Just put the script at the bottom of the page, or right underneath the menu.
__________________
Join me on
Please login or register to view this content. Registration is FREE

Last edited by wayfarer07; 11-25-2008 at 03:26 PM..
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to Changing how a link looks depending on the page.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.30076 seconds with 12 queries