Results 1 to 3 of 3

Thread: Hyperlink image in "Snow Effect" script?

  1. #1
    Join Date
    Jan 2010
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Lightbulb Hyperlink image in "Snow Effect" script?

    1) Script Title: Snow Effect

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex3/snow.htm

    3) Describe problem: No problem. The script runs fine. I'm just wondering if it's possible to hyperlink the "snowsrc=" image? I would like to link it to an URL rotator such as "http://xxxxxx.com/mysite/roto.html" and open in a new window.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Here is where in the script that the images are written out:

    Code:
          if (i == 0) {
            document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><a href=\"http://dynamicdrive.com\"><img src='"+snowsrc+"' border=\"0\"><\/a><\/div>");
          } else {
            document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/div>");
          }
    That if (i == 0) and else bit is checking to see if it is the first snowflake, if so it links it to Dynamic Drive:

    Code:
    <a href=\"http://dynamicdrive.com\"><img src='"+snowsrc+"' border=\"0\"><\/a>
    You probably want to link all of the snowflakes, if so we can greatly simplify the code (replace all of the code at the top of this post with):

    Code:
            document.write('<div id="dot'+ i +'" style="position: absolute; z-index: '+ i +'; visibility: visible; top: 15px; left: 15px;"><a target="_blank" ' +
            'href="http://dynamicdrive.com"' +
            '><img src="'+snowsrc+'" border="0"><\/a><\/div>');
    Replace http://dynamicdrive.com with the URL to your rotator page.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    Crill (01-16-2010)

  4. #3
    Join Date
    Jan 2010
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Thumbs up Thanks

    Thank You John,
    That worked very well. Took me awhile to realize it was working. It's a lot easier for the cursor to catch that small moving image than it is for the browser to catch the link. (I guess) Nevertheless, as long as I click like crazy at the images, they do eventually link through.

    Claude

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
  •