|
带颜色变化的连接按钮 |
|
1.将下面的代码复制到 <head> 内
<style> <!-- /*change the color name below to the color you want initially applied to the button. ie:blue*/ .initial2{font-weight:bold;background-color:lime} //--> </style> <script> <!-- /* Rollover background-color button Script- ?Dynamic Drive (www.dynamicdrive.com) For full source code, installation instructions, 100's more DHTML scripts, and Terms Of Use, visit dynamicdrive.com */ function change(color){ var el=event.srcElement if (el.tagName=="INPUT"&&el.type=="button") event.srcElement.style.backgroundColor=color } function jumpto2(url){ window.location=url } //--> </script> 2.将下面的代码复制到 <body> 或者内 <form onMouseover="change('yellow')" onMouseout="change('lime')"> <input type="button" value="Yahoo " class="initial2" onClick="jumpto2('http://yahoo.com')"> <input type="button" value="Geocities " class="initial2" onClick="jumpto2('http://Geocities.com')"> <input type="button" value="ABC News " class="initial2" onClick="jumpto2('http://abcnews.com')"> </form> 3.使用方法在需要使用此效果的连接上加上 <input type="button" value="Yahoo " class="initial2" onClick="jumpto2('http://yahoo.com')"> 指定class名称与点击事件. |