#1
  1. sleeping guru
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2003
    Location
    under the stars
    Posts
    2,444
    Rep Power
    177

    hover buttons and CSS not working


    i am having trouble with a hover button.
    it works fine in just an HTML page but when i put it on a CSS & php page nothing happens when i hover over it can anyone advise me on how to resolve this please.....thank you

    here is the code i am using for the button....

    Code:
    <a href="productinfo.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Add Button','','images/buttons/infoover.jpg',1)"><img src="images/buttons/info.jpg" name="Add Button" width="32" height="31" border="0"></a>
    Thanks in advanced to any replies

    RF
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Location
    Shimonoseki / JAPAN
    Posts
    58
    Rep Power
    12
    If you are copying only that piece of code you've posted, it won't work. it calls 2 javascript functions.

    search for the javascript code with MM_swapImgRestore and MM_swapImage functions. and copy it too.
    hope this helps

    regards
    Sweet smell of a great sorrow lies over the land. Plumes of smoke rise, merge into the leaden sky. A man lies and dreams of green fields and rivers, but awakes to a morning with no reason for waking. He's haunted by the memory of lost paradise. In his youth or dream, he can't be precise. He's chained forever to a world that's departed. It's not enough, it's not enough.
    Gilmour
  4. #3
  5. sleeping guru
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2003
    Location
    under the stars
    Posts
    2,444
    Rep Power
    177
    rite, ok thanks for that reply but i have now also copied in the files and have had no luck...ive also added the onLoad bit to the body.....

    but the hover feature still dont work

    any other suggestions..

    Thanks

    RF
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Location
    Shimonoseki / JAPAN
    Posts
    58
    Rep Power
    12
    Did you copied all of these?

    Code:
    <SCRIPT LANGUAGE="JavaScript" 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>
    When you create a rollover image with Dreamweaver, it puts this javascript code automaticly right after the <TITLE> tag...
    Sweet smell of a great sorrow lies over the land. Plumes of smoke rise, merge into the leaden sky. A man lies and dreams of green fields and rivers, but awakes to a morning with no reason for waking. He's haunted by the memory of lost paradise. In his youth or dream, he can't be precise. He's chained forever to a world that's departed. It's not enough, it's not enough.
    Gilmour
  8. #5
  9. sleeping guru
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2003
    Location
    under the stars
    Posts
    2,444
    Rep Power
    177
    yes i did
  10. #6
  11. sleeping guru
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Feb 2003
    Location
    under the stars
    Posts
    2,444
    Rep Power
    177
    ok here is what i have on the page (that is relevant)

    Code:
    <script language="JavaScript" 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>
    </head>
    <body onLoad="MM_preloadImages('images/buttons/infoover.jpg')">
    ...
    and then for the button in a php echo statement

    Code:
    <a href=\"productinfo.php?prod_id=$row[5]\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('InfoButton','','images/buttons/infoover.jpg',1)\"><img src=\"images/buttons/info.jpg\" name=\"InfoButton\" width=\"32\" height=\"31\" border=\"0\"></a>
    is that ok?

    thanks for your assistence

    RF

IMN logo majestic logo threadwatch logo seochat tools logo