PDA

View Full Version : links/javascript not working in Firefox



gib65
06-14-2010, 06:10 PM
Please open Firefox and go to http://www.surrealsource.com.

You might have to wait a few minutes for the page to fully download, but once it does, try clicking on any thumb on the left. Nothing happens, right? In any other browser, the user is able to click on a thumb and have an enlarged view of that image appear in the main viewing area. But not in Firefox.

Why?

Here's some of my code:

I'm using a motion gallery, the source of which can be found at:
http://www.dynamicdrive.com/dynamicindex4/cmotiongallery.htm

Here's an example entry in the gallery:



<tr><td><a href="#nogo" onclick="changePic(MAGIC_SHOW);return false;"><img src="thumbs/magic_show.jpg" border=1></a><br>Magic Show</td></tr>


Here's my code for changePic:



function changePic(num) {

textdiv.style.display = "none"; // visible on first page load
picdiv.style.display = "inline"; // where main picture is displayed
infodiv.style.display = "inline"; // info on current picture (date, title, comments) to right of picdiv

nextlink.innerHTML = "NEWER >>";
prevlink.innerHTML = "<< OLDER";

mainpic.src="mainpics/"+files[num];
title.innerHTML = titles[num];
date.innerHTML = dates[num];
comment_body.innerHTML = comments[num];

cur_pic=num;

if (cur_pic == last_pic) {
nextlink.style.display = "none";
}
else {
nextlink.style.display = "inline";
}

if (cur_pic == first_pic) {
prevlink.style.display = "none";
}
else {
prevlink.style.display = "inline";
}
...
}



Can anyone see the problem? Is it in my changePic function? Is it the "#nogo" value being assigned to the href attribute? What is it?

vwphillips
06-15-2010, 01:46 PM
function changePic(num) {
document.getElementById('textdiv').style.display = "none";
document.getElementById('picdiv').style.display = "inline";
document.getElementById('infodiv').style.display = "inline";

document.getElementById('nextlink').innerHTML = "NEWER >>";
document.getElementById('prevlink').innerHTML = "<< OLDER";

document.getElementById('mainpic').src="mainpics/"+files[num];
document.getElementById('title').innerHTML = titles[num];
document.getElementById('date').innerHTML = dates[num];
document.getElementById('comment_body').innerHTML = comments[num];

cur_pic=num;

if (cur_pic == last_pic) {
document.getElementById('nextlink').style.display = "none";
}
else {
document.getElementById('nextlink').style.display = "inline";
}

if (cur_pic == first_pic) {
document.getElementById('prevlink').style.display = "none";
}
else {
document.getElementById('prevlink').style.display = "inline";
}

if (cur_pic == FRACTURES) {
//document.getElementById('fractureslink').setAttribute('href', '#nogo', 0);
document.getElementById('mainpic').onmouseover = function(){mainpic.src="mainpics/fractures_odd.jpg";};
document.getElementById('mainpic').onmouseout = function(){mainpic.src="mainpics/fractures_even.jpg";};
document.getElementById('mainpic').setAttribute('usemap', '#fracturesmap', 0);
}
else {
//document.getElementById('fractureslink').removeAttribute('href', 0);
document.getElementById('mainpic').onmouseover = function(){return;};
document.getElementById('mainpic').onmouseout = function(){return;};
document.getElementById('mainpic').removeAttribute('usemap', 0);
}
return false;
}

gib65
06-15-2010, 09:33 PM
Thanks vwphilips,

That did the trick!