Hi guys,
I'm currently trying to convert this
Into something more like this
I didn't think this through much before I got into it, but hopefully you can see what I'm trying to do.
Instead of each button having 2 of its own functions for rolled over/rolled off, I'm trying to use the same function with every button using parameters.
I have been able to get the full command that I need to change the image displayed on a button when a user rolls over, but it's stored in a variable as a string. Is there anyway I can use this?
If this makes no sense whatsoever let me know and I'll try to make it more clear.
I'm currently trying to convert this
Code:
function mouseoverhome()
{
document.home.src ="home2.png"; //changes the image source atrribute of 'home'
}
function mouseouthome()
{
document.home.src ="home1.png";
}
function mouseovercontactus()
{
document.contactus.src ="contactus2.png";
}
function mouseoutcontactus()
{
document.contactus.src ="contactus1.png";
}
etc for each button
Into something more like this
Code:
function rollover(name, over)
var over;
var overorout;
var name;
var imgsrc
{
switch(over)
{
case 1:
overorout = "2"
break
case 0:
overorout = "1"
break
}
imgsrc = 'document.' + name + '.src = "' + name + overorout + '.png"';
}
I didn't think this through much before I got into it, but hopefully you can see what I'm trying to do.
Instead of each button having 2 of its own functions for rolled over/rolled off, I'm trying to use the same function with every button using parameters.
I have been able to get the full command that I need to change the image displayed on a button when a user rolls over, but it's stored in a variable as a string. Is there anyway I can use this?
If this makes no sense whatsoever let me know and I'll try to make it more clear.