active gifs

Sharky Forums


Results 1 to 7 of 7

Thread: active gifs

  1. #1
    Goldfish
    Join Date
    Feb 2001
    Location
    USA
    Posts
    63

    Question active gifs

    I have seen on some internet web sites active gifs where when you hover over them they will change. like on menus the backround will go from black to white
    can someone help me in accomplishing this or lead me to a program that can do this thanks in advance
    1GHZ TBird asus a7v133
    512 meg crucial Geforce 3

  2. #2
    Hammerhead Shark
    Join Date
    Oct 2000
    Location
    Toronto, Canada
    Posts
    1,493

    Post

    To do this in HTML, you need to use Javascript to help you. For example, add this in front of your HTML code, exception to change the filename:

    function MM_swapImgRestore() {
    if (document.MM_swapImgData != null)
    for (var i=0; i<(document.MM_swapImgData.length-1); i+=2)
    document.MM_swapImgData[i].src = document.MM_swapImgData[i+1];
    }

    function MM_swapImage() {
    var i,j=0,objStr,obj,swapArray=new Array,oldArray=document.MM_swapImgData;
    for (i=0; i < (MM_swapImage.arguments.length-2); i+=3) {
    objStr = MM_swapImage.arguments[(navigator.appName == 'Netscape')?i:i+1];
    if ((objStr.indexOf('document.layers[')==0 && document.layers==null) | |
    (objStr.indexOf('document.all[') ==0 && document.all ==null))
    objStr = 'document'+objStr.substring(objStr.lastIndexOf('.'),objStr.l ength);
    obj = eval(objStr);
    if (obj != null) {
    swapArray[j++] = obj;
    swapArray[j++] = (oldArray==null | | oldArray[j-1]!=obj)?obj.src ldArray[j];
    obj.src = MM_swapImage.arguments[i+2];
    }
    }
    document.MM_swapImgData = swapArray;
    }

    then, in every gif, you simply add

    onMouseOver = "scriptname ('new gif.gif');


    I know it is confusing above. Check http://javascript.internet.com for an easier example.


    ------------------
    I am crab, scoins is crap.
    DHAHL3seasons GP:73 G:121 A:55 Pts:176 GWG:12 +/-:184
    UWSWA6seasons GP:41 G:53 A:46 Pts:99 GWG:5 +/-:-25
    MCBHL3seasons GP:14 G:20 A:8 Pts:28 GWG:4 +/-:19

    uwcdc.com or monkis.com

  3. #3
    Reef Shark gammaray51's Avatar
    Join Date
    Sep 2000
    Location
    Virgina Beach, VA
    Posts
    493

    Post

    either that or flash. It boils down to.. flash cost money, java is free.

  4. #4
    Mako Shark dighn's Avatar
    Join Date
    Nov 2000
    Location
    Vancouver, BC Canada
    Posts
    3,171

    Post

    It's not Java, it's JavaScript. You can also do it in Java but it's not worth the trouble.

    ------------------
    someone set up us the bomb!
    .

  5. #5
    Reef Shark buddylee123's Avatar
    Join Date
    Nov 2000
    Location
    Raleigh, NC, USA
    Posts
    361

    Post

    Flash doesn't cost any money, you know what i'm talking about. (inapropriate!=0 )

    ------------------
    I enjoy ham
    My Precious

    Athlon XP 2200+
    Epox EP-8k5a2
    Radeon 9700 128mb DDR
    Mushkin DDR 512MB PC-3000
    Samsung 80gb 7200rpm HDD
    Sony 52x CD-ROM
    Sound Blaster Audigy Gamer

    3DMark2001 SE - 13,020 Marks

  6. #6
    Tiger Shark
    Join Date
    Mar 2001
    Location
    Next door.
    Posts
    546

    Post

    the above image swap code is very good, however here is yet another version:

    the preload script in the head section (it preloads each image into the system's cache):

    var image1=new Image()
    image1.src="yourmousedoverimage.gif"

    copy the above for all of the images you wish to preload.

    then, you must make each image a link:

    <a href="#" onMouseOver="image1.src='yourmousedoverimage.gif'"; onMouseOut="image1.src='yourimage.gif'"; return false><img src="yourimage.gif" name="image1"></a>

    Follow this method for all of your images assigning each one a different name...if this is confusing, http://www.webmonkey.com has some great javascript tutorials. The other method posted far above would be a better choice, but again, it is a matter of preference



    ------------------
    "There are two steps to success: 1. Never tell everything you know 2. See #1"
    BLAH

  7. #7
    Goldfish
    Join Date
    Feb 2001
    Location
    USA
    Posts
    63

    Post

    just thought i would say thanks for the help you guys were very helpful
    1GHZ TBird asus a7v133
    512 meg crucial Geforce 3

Posting Permissions

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