36 users online (2 members and 34 guests)  


  Results 1 to 5 of 5

Related

  1. css active link problem    Forum: CSS Forum
    Replies: 9
  2. State / Country XML    Forum: Website Scripts Forum
    Replies: 0
  3. Region/Country/State Chooser    Forum: Website Scripts Forum
    Replies: 0
  4. Active Links    Forum: HTML Forum
    Replies: 11
  1. #1
    LawlorT's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2003
    Posts
    1

    Unhappy Rollover active state

    If any one can help, I've been trying to get the link that is active to change states so that it is a different color when you are one the page (to let the viewer know what page they are on. This is what I have and it isn't working:

    .topnav {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-style: normal;
    color: #333333;
    text-decoration: none;
    }
    .topnav a:link {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-style: normal;
    color: #333333;
    text-decoration: none;
    }

    .topnav a:visited {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-style: normal;
    color: #333333;
    text-decoration: none;
    }

    .topnav a:hover {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-style: normal;
    color: #66cc00;
    text-decoration: none;
    }

    .topnav a:active {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-style: normal;
    color: #6633cc;
    text-decoration: none;
    }


    If anyone has advice, I would love the help.

  2. #2
    Android's Avatar

    Status
    Offline
    Join Date
    Oct 2002
    Location
    I AM CANADIAN
    Posts
    440

    Talking Want an educated guess?

    As they are Microsoft proprietary functions, I wouldn't be at all surprised if it has something to do with the version of IE, Windows, processor, time of day, length of time since your last crash, any combination of the aforementioned circumstances, etc.
    The only way I've ever gotten a:active to work is by using frames, where the menu is in a different frame from the body of the page. Then the active action works.
    I hope somebody else can tell me if it can work in unframed pages as well and show us how!

  3. #3
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    I wish I could. :active only applied to a loading link, which is why it works in frames (they are never 'reloaded' even when the page changes.)

    Your best bet would be to either manually make the 'active' link a different class or maybe some server-side scripting or JavaScript to do it automatically.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  4. #4
    Android's Avatar

    Status
    Offline
    Join Date
    Oct 2002
    Location
    I AM CANADIAN
    Posts
    440
    Quote Originally Posted by QuietDean
    maybe some server-side scripting or JavaScript to do it automatically.
    Knowing enough javascript to really mess up a webpage, is "onload" and event that can only be applied to a body tag? For instance, rather than change the CSS attributes for a navigational link (to show which page you're currently on) could you use something like :
    Code:
    <a href="" onload="document.write('class="active"') alt="page you are on">
    and set up the "actve" attributes in a style sheet?
    Of course, this would do the same thing as changing the style inline
    For example:
    Code:
    <a href="" style="color:#different;" alt="page you are on">
    in that you'd have to deal with it on every page rather than maintain it from one location, but it would be more apt to be cross-browser compatible.
    if it could it be done this way, what would be the correct syntax?

  5. #5
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Good idea. Yes , onload applies to the body tag.

    Syntax..hmm..
    Easiest would be each link to have an id, then
    Code:
    <body onload="document.getElementById('blah').className='myActiveClassName';">
    <a href="blah.html" id="blah">Blah</a>
    In theory, that would change the class of the chosen ID on page load. Untested!
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Tags for this Thread