Greetings JavaScriptors. I come to you from the vbscript forum as a fish out of water. I know lots about vbscript and very little of javascript.
My searches online tell me that javascript is the best tool to use for creating a function to swap out an image on a web page and I have found a few examples that do work for me.
But here is my problem. I have a table with 2 columns. In each column there are 5 rows with 2 images, side by side.I want a mouse over on either one of the images in a row to change both images.
For standardization I have a naming convention such as:
Image IDs are SpecialEventsNav.gif and SpecialEventsTxt.gif
The image files have a standard too:
SpecialEventsNavOff.gif and SpecialEventsTxtOff.gif
The mouseover values would be:
SpecialEventsNav_On.gif and SpecialEventsTxt_On.gif
So here is my pseudo code of how I think this should be processed.
1. First need to get the button info, something like
Name = Left(id,Len(id)-10)
which should return "SpecialEvents" in this case.
2. Switch image values
Mouse on value => Name+"Nav" src= Name + "Nav_On.gif"
Mouse on value => Name+"Txt" src= Name + "Txt_On.gif"
3. On mouseout switch back
Mouse on value => Name+"Nav" src= Name + "NavOff.gif"
Mouse on value => Name+"Txt" src= Name + "TxtOff.gif"
So the question is can anyone assist this javaScript rookie with a proper function that could do this?
Thanks in advance
Mark
My searches online tell me that javascript is the best tool to use for creating a function to swap out an image on a web page and I have found a few examples that do work for me.
But here is my problem. I have a table with 2 columns. In each column there are 5 rows with 2 images, side by side.I want a mouse over on either one of the images in a row to change both images.
For standardization I have a naming convention such as:
Image IDs are SpecialEventsNav.gif and SpecialEventsTxt.gif
The image files have a standard too:
SpecialEventsNavOff.gif and SpecialEventsTxtOff.gif
The mouseover values would be:
SpecialEventsNav_On.gif and SpecialEventsTxt_On.gif
So here is my pseudo code of how I think this should be processed.
1. First need to get the button info, something like
Name = Left(id,Len(id)-10)
which should return "SpecialEvents" in this case.
2. Switch image values
Mouse on value => Name+"Nav" src= Name + "Nav_On.gif"
Mouse on value => Name+"Txt" src= Name + "Txt_On.gif"
3. On mouseout switch back
Mouse on value => Name+"Nav" src= Name + "NavOff.gif"
Mouse on value => Name+"Txt" src= Name + "TxtOff.gif"
So the question is can anyone assist this javaScript rookie with a proper function that could do this?
Thanks in advance
Mark