Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Please Help!!! Highlighting content based on anchor links

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #36300
    ernest
    Member

    I’m trying to make a page that has anchor links to another page like this…
    I uploaded a shortened version of my page at http://www.jollyfarmer.com/developing/index.html
    I’m sorry, the code is really long, but I think you’ll be able to find where I’m trying to do this.

    This link is on a page is called “index.html”

  • Vegetable Transplants
  • When I click this link, I want it to go to “greenhousecatalogs.html” and scroll down to the anchor link “#transplants” and HIGHLIGHT THIS LINK, so that users will know which link they should click. I tried to do it like this…

    Below is the link on “greenhousecatalogs.html”.

  • Transplants Flier.pdf
  • Then I added this script to the page. (This was supposed to look for #transplants and add a class of “highlight”)

    Finally, I added this CSS to the top of the page…

    li.highlight {
    background-color: #FC0;
    padding: 5px;
    }

    But here’s the problem…. IT DOESN’T WORK. When I load the page “greenhousecatalogs.html” It ALWAYS hilights that link. And when I come from the “index.html” page to “greenhousecatalogs.html#transplants”, It isn’t hightlighted. :( CAN ANYONE HELP ME? I KNOW NEARLY NOTHING ABOUT JAVASCRIPT!
    heres the links…
    To the page with the #anchor target…
    http://www.jollyfarmer.com/developing/index.html
    To the page that is the target…
    http://www.jollyfarmer.com/developing/greenhousecatalogs.html

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.