0

For one webpage of my website, there is a sidebar that I want to use to change the image on the page. I think I should be able to do it by giving the first link of the sidebar the tag and the second link and so on. This should add #1 or #2 to the end of the url without changing the page on which it is on (I think). Using this, would it be possible to change the image, depending on the ending of the url (maybe by setting the id of the first image to "#1" and the second "#2" etc. then somehow hiding all images except the one selected?

Sorry if I'm being unclear, what I basically mean is that the webpage will act like a template, but the url won't change, instead the hash anchor thingy will change, which will cause the image and text to change but nothing else.

Here is the links table:

<table>
    <thead>Header</thead>
    <tr>
        <td>
            <a href="#1">Link 1</a>
        </td>
        <td>
            <a href="#2">Link 2</a>
        </td>
    </tr>
</table>

And the main CSS:

td a {
    display:block;
    height:100%;
    width:100%;
}

Using this I want an array of images so that only one will show at a time, depending on the hash number after the url (or any other way which may work better).

User2468
  • 99
  • 1
  • 10
  • After viewing websites which use this, I can see that they too, use # hrefs for the links. They hve then overlayed the images into a div. The only thing I can't work out is, the display changes to block for one image, and none for the others, depending on which link is clicked. How do I set the display to change with the #? – User2468 Apr 18 '14 at 09:43
  • They also change the z index of the wanted image to increase by 1, and the previous image to decrease by 1, but again, I'm not sure how. – User2468 Apr 18 '14 at 09:51

1 Answers1

0

a better way would be to give each anchor tag an onclick attribute to trigger a javascript function that will draw the desired image

one stevy boi
  • 577
  • 6
  • 24
  • How would I write the javascript part for it? – User2468 Apr 17 '14 at 20:47
  • thanks for the quick reply, however I still can't quite figure it out. Would the link you sent mean that only one image is shown at a time, depending on which of the links is clicked? And if it is correct, as I only know the very basics of javascript, how would I implement it all into my links to trigger the function? – User2468 Apr 17 '14 at 21:41