Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2009
    Location
    public_html/cgi-bin/
    Posts
    89
    Thanks
    14
    Thanked 1 Time in 1 Post

    Question Link within a link

    Hey everyone

    It's really hard to explain this so I need to show you... Ignore most of the code in this page but hit ctrl f and type "images/cinema_display.jpg" and you should get to the exact part

    http://wiispeakapple.co.uk/v2/reviews/reviews.html

    If you actually go onto the page, what I am trying to do is when you click that cinema display a larger one is shown to the right, I want that larger image on the right to then link to another page. I want it to be unique for every image, though. Is this possible?

    Thanks for any responses, all appreciated

    Owen Ayres

  • #2
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    Yes, you can do some javascript to get that to work as intended. I would alter your code a bit before doing that though. The thumbnail link should probably be set up to be the actual item page rather than the image source for the item's large image. That way if a user has javascript disabled they can still get to the product review. Then you can have javascript update the main image with a link to the review by the same method you currently have the image source being changed.

    That would leave you with the issue of getting the right image source over to the main image, which could be done a number of ways. If your file naming convention is static you could simply check the image source of the image within the link that triggers the javascript and then remove the "_thumb" portion of the name and that would send you to the correct fullsize image.

    On the other hand, if naming is not always so predictable, you could store the full-size image's URL in the "rel" attribute of the anchor tag and access that through javascript just as you would do for the "href" attribute.

    I'm not sure if I'm explaining that clearly, but it makes perfect sense in my head!
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • #3
    New Coder
    Join Date
    Aug 2009
    Location
    public_html/cgi-bin/
    Posts
    89
    Thanks
    14
    Thanked 1 Time in 1 Post
    Thanks for the reply!

    It makes a bit of sense to me, but there is one major issue: I'm a newbie in Javascript haha.
    No worries anyway though, I've decided to switch to a simpler method because I will be updating this regularly and so wish to keep it clean and easy to understand for myself!

    Again, thanks for the effort made to respond though!

    Cheers
    Owen Ayres


  •  

    Posting Permissions

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