Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    May 2003
    Posts
    12
    Member #
    1474
    Hello,

    I am a total newbie and no nothing about js but want to use the image swap script (following) to change menu images on my site. I can make it work for one menu item only - if i try it on a secong it all stops working. Can you tell me where i am going wrong?

    <a href="index.htm" onMouseOver="document.enter.src='gfx/homep.gif';" onMouseOut="document.enter.src='gfx/homep2.gif';"><IMG SRC="'gfx/homep2.gif'" WIDTH=94 HEIGHT=26 ALT="" name="enter" border="0"></a></TD>

    Thank you!

  2.  

  3. #2
    Junior Member
    Join Date
    Apr 2003
    Location
    Pottstown, PA
    Posts
    16
    Member #
    1041
    Try this:

    Put this in the <head> section:

    <script language="javascript" type="text/javascript">
    <!--
    a1=new Image(50,40)
    a1.src="http://image1.gif"
    a2=new Image(50,40)
    a2.src="http://image2.gif"
    //-->
    </script>
    <script language="javascript" type="text/javascript">
    <!--
    function filter(imagename,objectsrc){
    if (document.images)
    document.images[imagename].src=eval(objectsrc+".src")
    }
    //-->
    </script>


    Then use this to trigger the image flip:

    <a href="url.htm"
    onmouseover="filter('img1','a2'); window.status='Status Message';return true;"
    onmouseout="filter('img1','a1'); window.status='';return true;" onclick="window.focus()">
    <img src="image1.gif" name="img1" border=0 width=59 height=47></a>


    Tested this in IE, NS, and MOZ. It should work. Let me know if you have any questions.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:04 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com