Mega Code Archive

 
Categories / JavaScript DHTML / Form Control
 

Animating Buttons with JavaScript

<html> <head>   <title>JavaScript Unleashed</title>   <script type="text/javascript" language="JavaScript1.1">   <!--         // Define image objects     var prevBtnOff = new Image(42, 52);     prevBtnOff.src = "http://www.rntsoft.com/style/logo.png";         var prevBtnOn =  new Image(42, 52);     prevBtnOn.src = "http://www.rntsoft.com/style/logoRed.png";         var nextBtnOff = new Image(42, 52);     nextBtnOff.src = "http://www.rntsoft.com/style/logo.png";         var nextBtnOn =  new Image(42, 52);     nextBtnOn.src = "http://www.rntsoft.com/style/logoRed.png";         // Changes image being displayed.     function highlightButton(placeholder, imageObject) {       document.images[placeholder].src = eval(imageObject + ".src")     }       //-->   </script> </head> <body background="./aiback.gif">   <center>     <a href="javascript:history.back()"        onmouseover="highlightButton('Prev','prevBtnOn');                     window.status='Previous';                     return true;"        onmouseout="highlightButton('Prev','prevBtnOff');                    window.status='';                    return true;">       <img src="./prev_off.gif" border="0" width="52" height="42" name="Prev">     </a>     <a href="javascript:history.forward()"        onmouseover="highlightButton('Next','nextBtnOn');                     window.status='Next';                     return true;"        onmouseout="highlightButton('Next','nextBtnOff');                     window.status='';                     return true;">       <img src="./next_off.gif" border="0" width="52" height="42" name="Next">     </a>   </center> </body> </html>