Jump to content

Java script question


Drew

Recommended Posts

I appear to be an idiot. If anyone could tell me what's wrong with my java script rollover code, I would be most appreciative. While Weidu is clearly not Java, I'm figuring that this is as good a place as any to ask the question.

<!-- Old Browsers Ignore the Following 
<script language="JavaScript">

function goToLink(form)
{
location.href = form.options[form.selectedIndex].value;
}

//mouseover effects

if (document.images) {

glossyon = new Image(); 
glossyon.src = "../web_graphics/glossyon.gif";

glossyoff = new Image(); 
glossyoff.src = "../web_graphics/glossyoff.gif";
}

function imgOn(imgName,imgObjName) {
if (document.images) {
document[imgName].src = imgObjName;
}
}
  
function imgOff(imgName,imgObjName) {
if (document.images) {
document[imgName].src = imgObjName;
}
}

</script>
-->


In body:

<a href="../pages/potn.html" onMouseOver="imgOn('glossy','../web_graphics/glossyon.gif)" onMouseOut="imgOff('glossyOff','../web_graphics/glossyoff.gif')" title="Read more about Prince of the Narwhals">
<img src="../web_graphics/glossyoff.gif" width="30" height="30" border="0" name="glossy"></a>  

Link to comment

tbh, I'd suggest ditching the javascript and using CSS rollovers so you can reach that 10% of users that don't have JS enabled. You can assign the images as backround to a and the hover image to a:hover.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...