View Full Version : Help with Image Gallery Href ... basic coding

05-30-2008, 01:44 AM
Any help is appreciated. I'm sure this is easy to do, but not for me :)

Entire script is below the stars.

I want the arday image (that changes daily) to be clickable and point to the page "collection.htm". So I need an <a href="collection.htm"><img src="[the arday code here ]"></a>



<!-- Changing Image Gallery -->


<!-- This script and many more are available free online at -->
<!-- Rainbow Arch: http://rainbow.arch.scriptmania.com -->

<!-- Begin
today = new Date();
day = today.getDay();
arday = new Array("images/sunday.jpg", "images/monday.jpg", "images/tuesday.jpg",
"images/wednesday.jpg", "images/thursday.jpg", "images/friday.jpg", "images/saturday.jpg");

document.write("<img src='" + arday[day] + "'>");
// End -->

05-30-2008, 02:25 AM
Just add the highlighted:

document.write("<a href="collection.htm"><img src='" + arday[day] + "'></a>");

This will result in your image having a border. You can style it's border to 0px if it annoys you.

Hope that helps.

05-31-2008, 06:20 AM
I really appreciate your reply. I gave it a go, but the image completely disappears when I type it in as you suggested.

It's fine without the link, but it'd be great if someone could see any obvious mistake in the code.

Thanks :)

05-31-2008, 06:37 AM
My bad, try it with only one quote:

document.write("<a href='collection.htm'><img src='" + arday[day] + "'></a>");

05-31-2008, 08:23 AM
Oh you are so wonderful! It works!

I even downloaded Firebug but spent the last hour trying to work out how to use it :) Can't thank you enough.