你的位置:
主页
>>
按钮特效
有背景图片的按钮
加入如下代码到head区域
<style> <!-- //change the file path below to the image you want initially applied to the button .initial{font-weight:bold;background-image:url(1.gif)} //--> </style> <script> <!-- /* Rollover background-image Script- ?Dynamic Drive (www.dynamicdrive.com) For full source code, installation instructions, 100's more DHTML scripts, and Terms Of Use, visit dynamicdrive.com */ if (document.images){ after=new Image() //change the file path below to the image you want applied when the mouse moves over after.src="2.gif" } function change2(image){ var el=event.srcElement if (el.tagName=="INPUT"&&el.type=="button") event.srcElement.style.backgroundImage="url"+"('"+image+"')" } function jumpto2(url){ window.location=url } //--> </script>
加入如下代码到body区域
<form onMouseover="change2('2.gif')" onMouseout="change2('1.gif')"> <input type="button" value="Example 1 " class="initial" onClick="jumpto2('1.htm')"> <br> <input type="button" value="Example 2 " class="initial" onClick="jumpto2('2.htm')"> <br> <input type="button" value="Example 3 " class="initial" onClick="jumpto2('3.htm')"> <br> </form>