...

View Full Version : image switcher script modification



canadianjameson
06-17-2004, 05: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
http://www.enviromark.ca/img/werd.htm

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"

</SCRIPT>


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!

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

sad69
06-18-2004, 07: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!
Sadiq.

canadianjameson
06-18-2004, 09: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, 09:18 PM
I went the same way as sad69, slightly trimmed down though

canadianjameson
06-18-2004, 09: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?

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

does yours?

Mr J
06-18-2004, 11:16 PM
I was going to suggest using the switch method or probably an image map.


<script>
<!--
allow_default = true;

function show_images(n){

switch(n){
case 1 :
if(allow_default){
document.EnterOffSW.src = "EnterOn.gif";
document.EnglishOffSW.src = "EnglishOn.gif";
document.FrenchOffSW.src = "FrenchOn.gif";
}
break

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

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

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

default:"";

}

}
// -->
</script>


<table cellspacing="0" cellpadding="0" onmouseover="show_images(1)" onmouseout="show_images(2)">
<tbody>
<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>
</tr>
</tbody>
</table>

canadianjameson
06-19-2004, 01:29 AM
AWESOME.

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!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum