Hi All,
I am a javascript beginner and will really appreciate some help here. I have spent a considerable amount of time on a rollover function that never worked for me ?
All I am trying to do is have a rollover on a submit button on a html form. Ideally there should be an image on that button and when you rollover you see another image. However if this cannot be done it is ok to have the submit button as is and just see the 1 image when you rollover.
I have defined the images and the functions responsible for switching the images between in the head section of the html page. Here is the code:
<script language=javascript type=”text/javascript”>
if(document.images) {
img_off = new Image
img_on = new Image
img_off.src = “images/image1.gif”;
img_on.src = “images/image2.gif”;
}
function over(imageName)
{
if (document.images)
{
document[imageName].src = eval(imageName+”_on.src”);
}
}
function out(imageName)
{
if(document.images)
{
document[imageName].src = eval(imageName+”_off.src”);
}
}
</script>
I Then call my functions within the submit cell in the form as follows:
<td><input type=submit onmouseover=”over(‘image’)” onmouseout=”out(‘image’)” <img src=”../images/image2.gif” value=”continue” ></td>
This function call does not make sense to me, I took it from a javascript text book, I know there is something missing but I don’t know, I am also unsure if I am putting this code in the right place.
Thank you ?