Jump to content

[SOLVED] Rollover problems


Yesideez

Recommended Posts

Hi, trying to get a rollover image using Javascript but can't get it to work.

 

http://cheekymonkeys.pictureinthesky.net/equipment.php

 

That's the direct link to the page and the six orange buttons should change to yellow but nothing is happening, not even an error in the status bar.

 

Here's the code for the Javascript:

<script language="JavaScript">
rollImage=new Array()
rollImage[0]=new Image(141,23)
rollImage[0].src="/gfx/btn_cloudsstars.gif"
rollImage[1]=new Image(141,23)
rollImage[1].src="/gfx/btn_cloudsstars_sel.gif"
rollImage[2]=new Image(141,23)
rollImage[2].src="/gfx/btn_pinkfairy.gif"
rollImage[3]=new Image(141,23)
rollImage[3].src="/gfx/btn_pinkfairy_sel.gif"
rollImage[4]=new Image(141,23)
rollImage[4].src="/gfx/btn_obstaclecourse.gif"
rollImage[5]=new Image(141,23)
rollImage[5].src="/gfx/btn_obstaclecourse_sel.gif"
rollImage[6]=new Image(141,23)
rollImage[6].src="/gfx/btn_bouncyslide.gif"
rollImage[7]=new Image(141,23)
rollImage[7].src="/gfx/btn_bouncyslide_sel.gif"
rollImage[8]=new Image(141,23)
rollImage[8].src="/gfx/btn_sumosuits.gif"
rollImage[9]=new Image(141,23)
rollImage[9].src="/gfx/btn_sumosuits_sel.gif"
rollImage[10]=new Image(141,23)
rollImage[10].src="/gfx/btn_availableextras.gif"
rollImage[11]=new Image(141,23)
rollImage[11].src="/gfx/btn_availableextras_sel.gif"

function swapOut(imgName,imgID) {
  document.imgName.src=rollImage[imgID].src;
  alert "out";
  return true;
}

function swapBack(imgName,imgID) {
  document.imgName.src=rollImage[imgID].src;
  alert "back";
  return true;
}
</script>

 

Here's a line of HTML for one of the buttons:

<a href="equipment.php?item=clouds" onmouseover="swapOut('imgClouds',0)" onmouseout="swapBack('imgClouds',0)">
<img src="gfx/btn_cloudsstars.gif" name="imgClouds" alt="Clouds & Stars Castle" width="141" height="23" border="0" />
</a>

 

I've split the HTML onto 3 lines to make it easier to read.

 

I've also added an alert to help debug but I don't even get that.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.