带颜色变化的连接按钮

发布时间:2007年02月01日      浏览次数:1282 次
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名称与点击事件.
文章来源:http://www.aspxboy.com/myjs/baoku/0128.htm
免责声明:本站相关技术文章信息部分来自网络,目的主要是传播更多信息,如果您认为本站的某些信息侵犯了您的版权,请与我们联系,我们会即时妥善的处理,谢谢合作!