|
problems with my javascript
I am working on a website that has three javascript functions: one to make a random banner appear for each page, one to make an image gallery where thee are small thumbnails of images and a bigger box that the clicked image appears in, and a credits function where a transparent image appears over any image that the mouse is over which contains the dimensions, file size, and a clickable link to a website where the image came from. the transparent images with its contents disappears when the mouse is off the image. GETTING TO THE POINT (im not yelling, the capped text is just to direct those, who dont want to hear the previous text, to the main point of this question) I am having trouble with my credits with getting the link to work. Here is my script for the credits:
function showCredits(credits_index, parent_div) {
if (!document.getElementById("credits")) {
var dimensions = Array("397x288", "360x480", "360x480", "250x250", "250x250", "250x250", "400x265", "400x265");
var file_size = Array("214kb", "326kb", "326kb", "113kb", "92.2kb", "141kb", "156kb", "186kb");
var links = Array("www.sxc.hu", "www.ratemyscreensaver.com", "www.nationalgeographic.com", "www.flickr.com", "www.fruitsstar.com", "www.artistregister.com", "www.wandel.ca", "www.elephants.com");
var credits_div = document.createElement("div");
credits_div.setAttribute("id", "credits");
var dimensions_p = document.createElement("p");
var file_size_p = document.createElement("p");
var links_p = document.createElement("p");
var links_p_a = document.createElement("a");
var dimensions_p_text_node = document.createTextNode(dimensions[credits_index]);
dimensions_p.appendChild(dimensions_p_text_node);
var file_size_p_text_node = document.createTextNode(file_size[credits_index]);
file_size_p.appendChild(file_size_p_text_node);
var links_p_text_node = document.createTextNode(links[credits_index]);
links_p.appendChild(links_p_text_node);
credits_div.appendChild(dimensions_p);
credits_div.appendChild(file_size_p);
credits_div.appendChild(links_p);
credits_div.appendChild(links_p_a);
parent_div.appendChild(credits_div);
}
}
function hideCredits() {
if (document.getElementById("credits")) {
document.getElementById("credits").parentNode.removeChild(document.getElementById("credits"));
}
}
some notes: the credits id is defined in css where the transparent images is placed in.
p.s. it will be easier t o view the script if you copy and paste the text to MSword or to a text document.
Any answers are greatly appreciatwed by me.
|