Javascript Opcaity OnMouseOver

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Aug 2008
Posts: 22
Reputation: Agent Cosmic is an unknown quantity at this point 
Solved Threads: 0
Agent Cosmic Agent Cosmic is offline Offline
Newbie Poster

Javascript Opcaity OnMouseOver

 
0
  #1
Jan 31st, 2009
How do I animate an image to fade in when I roll my mouse over a <div> and fade out when I move my mouse away. So far this is what I have. It doesn't seem to work well. Please help me, thanks.

Javascript
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <script type="text/javascript">
  2.  
  3. var homebutton = document.homebtn.style.opacity;
  4. var portfoliobutton = document.getElementById("portfolioimg");
  5. var linkbutton = document.getElementById("linkimg");
  6. var aboutbutton = document.getElementById("aboutimg");
  7.  
  8. function home_on(){
  9. document.homebtn.style.opacity = document.homebtn.style.opacity + 0.1;
  10. }
  11. function home_off(){
  12. document.homebtn.style.opacity = document.homebtn.style.opacity - 0.1;
  13. }
  14. </script>

HTML
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <div id="homebg" onmouseover="home_on()" onmouseout="home_off()"><img name="homebtn" style="opacity: 0;" src="Home-On.png" alt="Home Button Image" /></div>
CLICK---> GeekPolice
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



Tag cloud for JavaScript / DHTML / AJAX
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC