PDA

View Full Version : somehow onmouseover button animation stopped functioning.



cyborg360
01-01-2010, 08:23 AM
on this site (http://users.rcn.com/**************/index_bh.html). There are no validation errors. firebug says my linkOut function is not defined... but I have this:


function linkOut(link)
{
var image = link.getElementsByTagName("IMG")[0];
image.src = image.src.replace("H2.png","H.png");
}




not sure where to go from here.:confused:

oesxyl
01-01-2010, 09:21 AM
on this site (http://users.rcn.com/**************/index_bh.html). There are no validation errors. firebug says my linkOut function is not defined... but I have this:


function linkOut(link)
{
var image = link.getElementsByTagName("IMG")[0];
image.src = image.src.replace("H2.png","H.png");
}




not sure where to go from here.:confused:
you are sure is not complain about linkOver?

best regards

cyborg360
01-01-2010, 09:24 AM
you are sure is not complain about linkOver?

best regards


yeah i just double checked. its linkOut that its saying is not defined.

oesxyl
01-01-2010, 09:29 AM
yeah i just double checked. its linkOut that its saying is not defined.
try 'img' instead of IMG and use alert to see what are link and image.

anyway, I can't find linkOver in page and onmouseover don't do nothing for me.

best regards

low tech
01-01-2010, 03:15 PM
Hi

I'm not a coder but I am using the rollover script like this.

Maybe it helps.



<script type="text/javascript">

function linkOver(link)
{
var image = link.getElementsByTagName("IMG")[0];

image.src = image.src.replace("Off_1.png","On_1.png");
image.src = image.src.replace("Off_2.png","On_2.png");
}

function linkOut(link)
{
var image = link.getElementsByTagName("IMG")[0];

image.src = image.src.replace("On_1.png","Off_1.png");
image.src = image.src.replace("On_2.png","Off_2.png");
}
</script>


Code:
<body>
a href="#" onmouseover="linkOver(this), onmouseout="linkOut(this);" ><img src="images/Off_1.png" />LinkText</a>
//
number of links to equal number of image sets
//
</body>

TinyScript
01-01-2010, 07:49 PM
a href="#" onmouseover="linkOver(this), onmouseout="linkOut(this);" ><img src="images/Off_1.png" />LinkText</a>


should be this

<a href="#" onmouseover="linkOver(this)" onmouseout="linkOut(this);" ><img src="images/Off_1.png" >LinkText</a>

cyborg360
01-01-2010, 11:35 PM
really hoping to avoid redoing all the code - as this was just working recently. I think the problem might be as simple as extra / or . somewhere but I've been unable to track it down.

firebug tells me the error details are:


linkOut is not defined
function onmouseout(event) { linkOut(this); }(mouseout clientX=1220, clientY=528)

but am not sure where to go from here. Would the next logical step be to locate where (1220, 528) is on the screen and see what element that is in the code? Does firebug have some sort of graph you can display on the screen to know where (1220, 528) is?

Old Pedant
01-02-2010, 09:04 PM
Look, regardless of what FireBug is saying, *CLEARLY* linkOver is *NOT* defined on that page. Period.

So until you get linkOver defined, who knows what else is going on???

You also have some BOGUS CSS:


/* hide the preloaded images for the mouseovers: */
div#hideme { visibility: hidden; }
div#hideme img { height: 1px; width: 1px; }

...

/* hide the preloaded images for the mouseovers: */
div#hideme { visibility: none;
height: 10px;
}
div#hideme img { height: 1px; width: 1px; }


First of all, there is no such thing as visibility: none;
But secondly, you have *TWO* conflicting definitions of the #hideme style.


And I just checked the page with FireBug myself, and indeed it correctly says the linkOver is not defined.

Fix that first.

Old Pedant
01-02-2010, 09:15 PM
I assume that the missing function should look like this:


function linkOver(link)
{
var image = link.getElementsByTagName("IMG")[0];
image.src = image.src.replace("H.png","H2.png");
}

How come not one of those images exists???

Ahhh...never mind...because the site bluehorizonenergy.com is down.