Simple Javascript But please help

Discussion in 'Programming' started by calisonder, Apr 17, 2007.

  1. #1
    i'm normally ok with javascript but i've been trying to quit nicotine cold turkey the past two days and it sucks...i can't control my anger/think clearly so can someone please help.


    all i'm trying to do is mouse over the tumbnail images, and cause the main image to change, and then go back to the origional image once the user removes there mouse from the tumbnail.

    please view image.


    will someone give me the code?

    thanks a lot in advance.
     

    Attached Files:

    calisonder, Apr 17, 2007 IP
  2. webcosmo

    webcosmo Notable Member

    Messages:
    5,840
    Likes Received:
    153
    Best Answers:
    2
    Trophy Points:
    255
    #2
    <html>
    <head>
    <script type="text/javascript">
    function MM_swapImgRestore() { //v3.0
    var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;
    }

    function MM_findObj(n, d) { //v4.01
    var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
    if(!x && d.getElementById) x=d.getElementById(n); return x;
    }

    function MM_swapImage() { //v3.0
    var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
    if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }
    </script>
    </head>
    <body>

    <img src="sander.jpg" name="mainimage" border="0" id="mainimage">


    <a href="javascript:;" onMouseOver="MM_swapImage('mainimage','','myimage1.jpg',1)" onMouseOut="MM_swapImgRestore()"><img src="image_thumb.jpg" name="thumb" width="26" height="26" border="0" id="thumb"></a>

    </body>
    </html>


    ==================
    Try this. I need some reputation, I am poor. :)
     
    webcosmo, Apr 17, 2007 IP
  3. calisonder

    calisonder Peon

    Messages:
    93
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thank you very much, how do i give reputation?
     
    calisonder, Apr 17, 2007 IP
  4. webcosmo

    webcosmo Notable Member

    Messages:
    5,840
    Likes Received:
    153
    Best Answers:
    2
    Trophy Points:
    255
    #4
    click on the scale on the right side of the bar(on my post).
    thank you.
     
    webcosmo, Apr 17, 2007 IP
    calisonder likes this.