View Full Version : image switcher script modification

06-17-2004, 06:30 PM
greetings once again.

i'm using a nicely coded image swap script and i need to do more with it than it can currently do... i put together a quick walkthrough as to what i need. simple changes, but still necessary.

here it is

here's the script

<SCRIPT language=JavaScript>
var EnterOn = new Image()
var EnterOff = new Image()
var EntrerOn = new Image()
var EntrerOff = new Image()
var EnglishOn = new Image()
var EnglishOff = new Image()
var FrenchOn = new Image()
var FrenchOff = new Image()

EnterOn.src = "EnterOn.gif"
EnterOff.src = "EnterOff.gif"
EntrerOn.src = "EnterOn.gif"
EntrerOff.src = "EntrerOff.gif"
EnglishOn.src = "EnglishOn.gif"
EnglishOff.src = "EnglishOff.gif"
FrenchOn.src = "FrenchOn.gif"
FrenchOff.src = "FrenchOff.gif"


and here's how you (I) activate it:

<img src="EnterOff.gif" width="210" height="101" name="EnterOffSW"
onmouseover="document.EnterOffSW.src = EnterOn.src; document.EnglishOffSW.src = EnglishOn.src; document.FrenchOffSW.src = FrenchOn.src"
onmouseout="document.EnterOffSW.src = EnterOff.src; document.EnglishOffSW.src = EnglishOff.src; document.FrenchOffSW.src = FrenchOff.src" />

thanks alot guys / girls... gotta run!

06-18-2004, 02:01 AM
anyone, yes/no/maybeso?

06-18-2004, 08:50 PM
Give this a try. I didn't fiddle too much with it, but I'm getting the gap between the top and bottom images... white border on the images?

Anyway, this seems to work. It's pretty basic. I don't have too much time as I'm really busy with work right now.

Hope that works out for you!

06-18-2004, 10:13 PM
i had a space in the table cell with the image (doh!).... kill that and you lose the white line :)

lemme go try out the script :)

Mr J
06-18-2004, 10:18 PM
I went the same way as sad69, slightly trimmed down though

06-18-2004, 10:24 PM
if it's completed, could i take a look at it?

also, did yours allow for the English & Francais images to be used as links?

06-18-2004, 10:47 PM
Sadiq's is good, but it doesnt allow me to have the onmouse'dOver images as links.

does yours?

Mr J
06-19-2004, 12:16 AM
I was going to suggest using the switch method or probably an image map.

allow_default = true;

function show_images(n){

case 1 :
document.EnterOffSW.src = "EnterOn.gif";
document.EnglishOffSW.src = "EnglishOn.gif";
document.FrenchOffSW.src = "FrenchOn.gif";

case 2:
document.EnterOffSW.src = "EnterOff.gif";
document.EnglishOffSW.src = "EnglishOff.gif";
document.FrenchOffSW.src = "FrenchOff.gif";

case 3:
document.EnterOffSW.src = "EnterOn.gif";

case 4:
allow_default = false;
document.EnterOffSW.src = "EntrerOn.gif";
document.EnglishOffSW.src = "EnglishOn.gif";
document.FrenchOffSW.src = "FrenchOn.gif";



// -->

<table cellspacing="0" cellpadding="0" onmouseover="show_images(1)" onmouseout="show_images(2)">
<tr><td colspan="2"><img name="EnterOffSW" src="EnterOff.gif" alt=""></td></tr>
<tr><td onmouseover="show_images(3)"><img name="EnglishOffSW" src="EnglishOff.gif" alt="" onclick="location='page1.htm'"></td>
<td onmouseover="show_images(4)" onmouseout="allow_default=true"><img name="FrenchOffSW" src="FrenchOff.gif" alt="" onclick="location='page2.htm'"></td>

06-19-2004, 02:29 AM

Both of you, thank you so much!

Sadiq: upon reflection i could have just added the <a href> because when the user onmouseover's anywhere in the table, the image changes anyways... sometimes i'm dumb :)

Mr. J: Thank you too, i like the script alot. I'd add it to your page if i were you, it may come in as handy to others as it did to me.

Thanks alot. if i can help either of you, please let me know!