Javascript doesn't work in IE8 or Firefox

Can you provide a working example so we can test to see what the problem is?

IE doesn’t give you anything to click on because there is nothing to click on in the link. Only the border in IE is recognising that the mouse is over it.

What you could do is to put a 1x1 transparant gif inside the link and set its width and height.

I don’t know of other solutions that would work on IE, unless anyone else has some ideas?

I have created a local simulation using your HTML (with the update) and script code, and some other functions to make it work, such as getStyleObject, changeBg, and changeBg2.

My simulation works well across all of Opera, Internet Explorer and Firefox, so that confirms that the problem lies with something else in your page that we have not yet seen.

You will need to provide a link to a test page, or some other way for us to experience the web page that fails to correctly work for you.

Is there anyone that can help me with this? I’m seriously stuck…

Here is the code for the external function for the changeMain. Maybe this is messing it up? Help…

function changeMain(the_div,the_change)
{
var the_style = getStyleObject(the_div);
if (the_style != false)
{
current = hiddenform.current.value;
changeBg(current);
the_style.background = “#ECE2C4 url(images/” + the_div + “_” + the_change + “.jpg) no-repeat 1px 1px”;
hiddenform.current.value = the_change;
changeBg2(the_change);
}
}

function next(the_div)
{
var the_style = getStyleObject(the_div);
if (the_style != false)
{
current = hiddenform.current.value;
if (current >= 15)
{
changeBg(current);
the_change = 1;
changeMain(the_div,the_change);

}
else
{
    changeBg(current);
    the_change = ++current;
    changeMain(the_div,the_change);

}  

}
}

function previous(the_div)
{
var the_style = getStyleObject(the_div);
if (the_style != false)
{
current = hiddenform.current.value;
if (current-1 >= 1)
{
changeBg(current);
the_change = --current;
changeMain(the_div,the_change);
}
else
{
changeBg(current);
the_change = 15;
changeMain(the_div,the_change);
}
}
}

You’d be better off using the onclick method for each of your anchors…

eg.

<div class="thumb"><a href="#image1" onclick="changeMain('gallery_img','1'); return false;" id="1" ></a></div>

THANKS Stephen…Please excuse my ignorance of JS.

Try returning false from the onmousedown so that the garbage you have in the href doesn’t try to run.

Do you mean…
<div class=“thumb”><a href=“javascript:;” onmousedown=False"changeMain(‘gallery_img’,‘1’)" id=“1” ></a></div>

Thank You for your help! Works perfect in opera & chrome. basically same deal with IE8 and FF. IE8 it seems like I can get images to change if I click on left side of thumb in exact right place. But it’s tough. I get no image change in Firefox.

Try returning false from the onmousedown so that the garbage you have in the href doesn’t try to run.

You really ought to replace the href garbage with something meaningful for those with JavaScript disabled as well.