Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts

    image switcher script modification

    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
    Code:
    <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:
    Code:
    	  <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!
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)

  • #2
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts
    anyone, yes/no/maybeso?
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)

  • #3
    Senior Coder
    Join Date
    Feb 2004
    Posts
    1,206
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Attached Files Attached Files

  • #4
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts
    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
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)

  • #5
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    I went the same way as sad69, slightly trimmed down though

  • #6
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts
    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?
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)

  • #7
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts
    Sadiq's is good, but it doesnt allow me to have the onmouse'dOver images as links.

    does yours?
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)

  • #8
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    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>

  • #9
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts
    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!
    Last edited by canadianjameson; 06-19-2004 at 02:32 AM.
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •