+ Reply to Thread
Results 1 to 5 of 5

Thread: Rollover Buttons with pictures

  1. #1
    naves's Avatar
    naves is offline x10Hosting Member naves is an unknown quantity at this point
    Join Date
    Sep 2008
    Location
    Guanajuato
    Posts
    65

    Exclamation Rollover Buttons with pictures

    Hey there i am wondering how i can make the pictures on my navigation have the swap effect i believe this can be done in java with ease.. does anybody have any suggestions?

    I have theese two pictures could somebody give me the code so they would create the rollover effect or give me a standard format that i could fill in the file names?
    that would be greatly appreciated.

  2. #2
    alz4445 is offline x10 Sophmore alz4445 is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    124

    Re: Rollover Buttons with pictures

    Yeah, sure. In your header:
    HTML Code:
    <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[i])&&x.oSrc;i++) x.src=x.oSrc;
    }
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }
    
    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[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].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[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }
    //-->
    </script>
    and where you want the pictures to appear, edit as necessary:
    HTML Code:
    <a href="http://LINKHERE.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Images_Unique_Name','','button_over.png',1)"><img name="Images_Unique_Name" border="0" src="button.png"></a>
    I hope you know what parts to edit, just do not edit the JavaScript.


  3. #3
    leafypiggy's Avatar
    leafypiggy is offline Community Advocate leafypiggy is on a distinguished road
    Join Date
    Aug 2007
    Location
    Massachusetts
    Posts
    2,228

    Re: Rollover Buttons with pictures

    really? thats a stupid code

    Code:
    #codehere {
    background-image("%pathtonavimage%");
    /*more code if you want*/
    }
    #codehere a:hover, a:active {
    background-image("%pathtorolloverimage%");
    /*more code if you want*/
    }
    just add more of them. and use:

    Code:
    <a href="http://forums.x10hosting.com/graphics-webdesign/page.html"><div id="codehere"></div></a>
    just replace "codehere" with w/e you used for the name of the CSS
    Neil Hanlon | x10Hosting Support Representative
    Neil[at]x10hosting.com
    █ I'm always happy to help. Just ask a question in Free Hosting
    Terms of Service IRC

  4. #4
    xPlozion's Avatar
    xPlozion is offline x10 Elder xPlozion is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Delaware, USA
    Posts
    872

    Re: Rollover Buttons with pictures

    javascript rollover should be dead by now, with css leading the way. only thing is that in internet explorer, you can't have img:hover, only a:hover. You can also preload the image using a:link

  5. #5
    naves's Avatar
    naves is offline x10Hosting Member naves is an unknown quantity at this point
    Join Date
    Sep 2008
    Location
    Guanajuato
    Posts
    65

    Re: Rollover Buttons with pictures

    Thanks to all...
    Comrades

+ Reply to Thread

Similar Threads

  1. Need help with design (small pictures,)
    By zograf in forum Graphics & Webdesign
    Replies: 1
    Last Post: 03-28-2008, 05:10 PM
  2. Problem with pictures
    By Aleksaas in forum Free Hosting
    Replies: 3
    Last Post: 11-28-2007, 12:39 PM
  3. SMF Buttons
    By Amrod in forum Free Hosting
    Replies: 1
    Last Post: 11-11-2007, 08:13 PM
  4. Office 12 Pre-Beta and Pictures
    By MicrotechXP in forum Off Topic
    Replies: 7
    Last Post: 10-29-2005, 07:18 PM
  5. Buttons
    By Vietkid58 in forum Feedback and Suggestions
    Replies: 12
    Last Post: 07-10-2005, 02:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers