SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Git-R-Done
    Join Date
    Nov 2001
    Posts
    1,194
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Linking to Hidden Content and Loading it in the Same Page?

    I have a page with few links that I would like the visitor to be able to click and load different text. I've done something like this before with images but not with just text. I can't figure out how to change the images at the top and how to link to the different <td> tags. Here's an example:

    The top has a sub nav bar with about 5 links. I would like to have the images change on mouseover and display another image when the user is viewing that section.

    Beneath the nav bar I have another table. I would like to do something with hidden div tags so when the user clicks the link it will load a different <td> tag with the different content. Kinda like this:

    <a href="name of div tag to display">Link 1 Image</a>

    Then the div tag would be:

    <div id="text1">
    <td>
    text here
    </td>
    </div>

    <div id="text2">
    <td>
    text here
    </td>
    </div>

    Does anybody know how to do this or of a website that shows how to do it?
    John Saunders

  2. #2
    SitePoint Member
    Join Date
    Sep 2002
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Linking to Hidden Content and Loading it in the Same Page?

    As for my opinion, the most easy way to solve problem use script for link for event onclick. Look at this:

    <a href="#" onclick="ChangeDivForShow(name of div tag to display)">Link 1 Image</a>

    <script language=javascript>
    ChangeDivForShow(divName)(){
    document.all.divName.style.display="";
    // below you must write style.display="none"; for each div that mustn't be displayed. You nay use a javascript collection getElementsByTagNames if it is convenient to you.
    document.all.divNameNotToBeShown1.style.display="none";
    ....
    }
    </script>

    You also can use not div but td elements. Give them names and getthis elements by names from script.

    Good Luck!
    __________________________
    With best regards,
    Julia Pavlova
    Programmer
    Rapid Internet Development
    AlarIT Inc.
    URL: http://www.alarit.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •