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 7 of 7
  1. #1
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts

    Exclamation Can one hyperlink a DIV?

    Some time ago I had a program where I wanted to use the images and thumbs to use by clicking the thumbs and getting the main jpeg on screen which I then wanted to get back to the index page. I managed to make it work without linking each seperate image by linking the Div that they were in.
    I cannot find the program now, but it worked well (to my surprise because I did not know why!) and had merely found it by trial and error.

    Have you any idea how I did it?

    Frank
    Last edited by effpeetee; 12-26-2007 at 09:30 AM.
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.

  • #2
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,274
    Thanks
    28
    Thanked 271 Times in 265 Posts
    Quote Originally Posted by effpeetee View Post
    Have you any idea how I did it?
    You can hyperlink a div element using non‐standard scripting. Below is an example of inline JavaScript.

    Code:
    <div onclick="window.location.href = 'http://www.ie7.com/';">HTML</div>
    Another method would be to put an anchor element inside of the div element and size the anchor element such that its height and width are the same as the div element. Below is an example.

    Code:
    a { display: block; }
    
    
    
    <div><a href="http://www.ie7.com/">HTML</a></div>
    Depending upon your needs, the div element may be unnecessary in the last example since display: block makes the anchor element behave identically to the div element.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #3
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts
    Thank you for your help.
    What I am trying to do is:
    I use a thumbnail of an image to link to the main jpg and then link back to the original showing of the thumbnails. At present I am using html to present the main image. It works fine accept the as I use the same images in more than one list, it means different html page for each menu that I need to return to. I have nearly 100 html pages which I have repeated four times in order to use in three seperate menus. eg 101a, 101b, 101c. As each page is identical is seems rather silly. Being able to link from the image by linking to its DIV would mean that I could just show the image without an unnecessary html page to carry it, in order to use the pages link.

    I hope that this is clear. Basically I need thumbnail, linked to main image linked back to thumbnails. Nothing else used. I did it once. Lost the original program and I am saddled with an 82 year old forgetary. (memory?)

    http://www.exitfegs.co.uk/Picchoosea.html
    http://www.exitfegs.co.uk/Picchoose.html

    This is how I do it at present.

    Frank
    Last edited by effpeetee; 12-27-2007 at 12:59 PM.
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.

  • #4
    Regular Coder
    Join Date
    Nov 2006
    Posts
    246
    Thanks
    13
    Thanked 26 Times in 24 Posts
    So you basically want an image gallery. Try this if you like:

    http://www.huddletogether.com/projects/lightbox2/

    You'll have to make a few edits, so read over it very carefully. I use it, and it works like a charm. Your thumbnail links will look like this:
    Code:
    <a href="http://www.domain.com/images/image.jpg" rel="lightbox" title="Image description"><img src="http://www.domain.com/images/thumbnail.jpg" alt="alternative" /></a>
    Last edited by Majoracle; 12-27-2007 at 12:30 AM.

  • #5
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts
    Thanks for your input, but I already have this and other galleries. My previous post tells what I need and why I need it. It is not just to get a gallery, but to enable me to use the same hyperlinked images in more than one list.

    http://www.exitfegs.co.uk/Picchoose.html

    http://www.exitfegs.co.uk/Picchoosea.html
    http://www.exitfegs.co.uk/Picchooseb.html
    http://www.exitfegs.co.uk/Picchoosec.html

    The last three use the same images as the first but have to return to different menus. This means each html has to be saved four times for the different links.

    eg 1.html 1a.html 1b.html etc

    I want to end that and just use the actual jpegs and fix the link to the DIV enclosing them.

    Frank
    Last edited by effpeetee; 12-27-2007 at 01:11 PM.
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.

  • #6
    Regular Coder
    Join Date
    Nov 2006
    Posts
    246
    Thanks
    13
    Thanked 26 Times in 24 Posts
    Oh I see. I'm sure others in the past have brought this up, but have you considered using a server-side language such as PHP with a database like MySQL? Provided you have access to such things. If not, that's a shame. With client-side scripting (HTML, CSS), there's not much you can do to simplify things unfortunately.

  • #7
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts
    Quote Originally Posted by Majoracle View Post
    Oh I see. I'm sure others in the past have brought this up, but have you considered using a server-side language such as PHP with a database like MySQL? Provided you have access to such things. If not, that's a shame. With client-side scripting (HTML, CSS), there's not much you can do to simplify things unfortunately.
    Thanks friend, but unfortunately my knowlegde of php is nil and at 82 years old I find html and css quite enough to cope with. Having said that it occured to me that my program "Sources", in my signature, does exactly what I need to do. I am now in the process of modifying it to serve again.

    Here it is. http://www.exitfegs.co.uk/ExpMenu.html

    Regards,

    Frank
    Last edited by effpeetee; 12-28-2007 at 02:10 PM.
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.


  •  

    Posting Permissions

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