精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>网络专区>>● 网站建设>>盖世神功 — 网站建设技术>>HTML — 做好一个网页不能没有的基础>>DHTML特效>>特效24:能变换背景的按钮

主题:特效24:能变换背景的按钮
发信人: marsz()
整理人: microant(1999-08-02 12:13:19), 站内信件
实例:能变换背景的按钮
适用浏览器:IE4+
 
说明:不用我说了吧,IE中按钮的功能是很强大的。

第一步:将下列代码复制到网页的Head和Body标记中间。



<style>
<!--//change the file path below to the image you want initially appli
ed to the button.initial{font-weight:bold;background-image:url(firstim
age.jpg)}//-->
</style>
<script>
<!--/*modified by mars 1999 ,www.joysoft.net*/if (document.images){aft
er=new Image()after.src="secondimage.jpg"}function change2(image){var
el=event.srcElementif (el.tagName=="INPUT"&&el.type=="button")event.sr
cElement.style.backgroundImage="url"+"('"+image+"')"}function jumpto2(
url){window.location=url}//-->
</script>


第二步:将下列代码放置你的网页中。



<form onMouseover="change2('secondimage.jpg')" onMouseout="change2('fi
rstimage.jpg')">
<input type="button" value="Example 1 " class="initial" onClick="jumpt
o2('1.htm')">
<br>
<input type="button" value="Example 2 " class="initial" onClick="jumpt
o2('2.htm')">
<br>
<input type="button" value="Example 3 " class="initial" onClick="jumpt
o2('3.htm')">
<br>
</form>

--
天上星 亮晶晶 永灿烂 保安宁

※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.106.172.165]

[关闭][返回]