View Full Version : Help with onmouseover conflict

12-09-2010, 09:47 AM
Alright, I'm trying to get this website finished within the next 5 hours. I was designing it in such a way that I have some rollover buttons that take me to various parts of the site. Then, I have a gallery page, where I have a simple rollover galley.

Adding the rollover gallery has stopped my buttons at the top from working.

First, my .js file

function swap_image(name,source) {
var argv=swap_image.arguments;
if(argv[2] && argv[3] && document.getElementById) {

if (document.images) {
image0 = new Image;
image1 = new Image;
image2 = new Image;
image0.src = '/images/male_fem.jpg';
image1.src = '/images/moon_wmn.jpg';
image2.src = '/images/mobydick.jpg';
} else {
image0 = '';
image1 = '';
image2 = '';
document.rollimg = '';

var cap = ['Picture One',
'Second Picture',

function rollover(n) {
document.rollimg.src = window['image'+n].src;
document.getElementById('caption').innerHTML = cap[n];

Now a portion of my html..

<a onmouseover="swap_image('gallery','/images/galleryro.jpg')" onmouseout="swap_image('gallery','/images/galleryhl.jpg')">
<img style = "top:150px; left:160px;" border="0" id="gallery" src="/images/galleryhl.jpg"/> </a>

<a href="timeline.htm" onmouseover="swap_image('timeline','/images/timelinero.jpg')" onmouseout="swap_image('timeline','/images/timeline.jpg')">
<img style = "top:150px; left:175px;" border="0" id="timeline" src="/images/timeline.jpg"/> </a>

<a href="biography.htm"onmouseover="swap_image('biography','/images/biographyro.jpg')" onmouseout="swap_image('biography','/images/biography.jpg')">
<img style = "top:150px; left:190px;" border="0" id="biography" src="/images/biography.jpg"/> </a>

<a href="contact.htm" onmouseover="swap_image('contact','/images/contactro.jpg')" onmouseout="swap_image('contact','/images/contact.jpg')">
<img style = "top:150px; left:205px;" border="0" id="contact" src="/images/contact.jpg"/> </a>

<div class = "lrgimg">
<p align = "center">
<img style = "top:150px" src="images/male_fem.jpg" width="auto" height="auto" border="0" alt="large" name="rollimg" />

<div class = "imgbar">
<p align = "center"><span onmouseover="document.rollimg.src=image0.src;">
<img style = "top:250px" src="images/male_fem_sm.jpg" width="32" height="32" border="0"alt="malefem"/> </span>

<span onmouseover="document.rollimg.src=image1.src;">
<img style = "top:250px" src="images/moon_wmn_sm.jpg" width="32" height="32" border="0" alt="moonwmn"/></span>

<span onmouseover="document.rollimg.src=image2.src;">
<img style = "top:250px" src="images/mobydick_sm.jpg" width="32" height="32" border="0" alt="mobydick"/></span>


Any help to quickly resolve the conflict, would be greatly appreciated. I don't have a lot of time.

Philip M
12-09-2010, 10:08 AM
Do please read the posting guidelines regarding silly thread titles. The thread title is supposed to help people who have a similar problem in future. Yours is useless for this purpose. You can (and should) edit it to make it more meaningful.

Why must it be done in 5 hours? Is it homework?

12-09-2010, 10:10 AM
Yes, it is homework.

12-09-2010, 10:31 AM
Any help you can provide, would be great.

Philip M
12-09-2010, 10:42 AM
Sounds like duplication of variable and/or function names. I do not see any "buttons at the top".

12-09-2010, 10:46 AM
all the images above my div class "lrgimg" are the "buttons" I was talking about.

galleryro.jpg galleryhl.jpg (Since this is a gallery page, I removed the link)

then we have timeline.jpg, and timelinero.jpg... the rollover happens, and it acts as a link to my timeline.htm

It's not just the rollover that has stopped. For some reason, adding in the rollover gallery (Which works fine) stops the images from working as links, as well. So I can't even click on any of them. It's very odd.

Philip M
12-09-2010, 10:50 AM
Have you tried using your error console or better still Firebug to detect syntax errors?

12-09-2010, 10:54 AM
Error console? I'm writing everything in notepad++

I've taken code from other internet sources, but I've fitted it to work, for me.
I don't have any automated help programs.

Can you please take a look, and see if there is anything you notice?

Philip M
12-09-2010, 11:23 AM
Error console? I'm writing everything in notepad++

Get Firebug!

12-09-2010, 11:33 AM
Nevermind, I figured it out without firebug.

I guess I'm a bit confounded by all the help I've seen on this site, and the complete apathy that has been displayed with regard to my problem.

Philip M
12-09-2010, 01:08 PM
Nevermind, I figured it out without firebug.

I guess I'm a bit confounded by all the help I've seen on this site, and the complete apathy that has been displayed with regard to my problem.

You posted in the middle of the night in the USA. Early morning GMT. I guess there are not too many people around in the forums at that time. And frankly some people will perhaps have been put off by "I'm trying to get this website finished within the next 5 hours". There is an obvious retort to that.