[HTML]可以控制背景颜色的代码

2013-06-30 07:30:15 -0400
演示.html (1.72 KiB) | Meta
代码:<html>
<head>
<title>网页特效|zzz.wodemo.com|---可控制的背景变化的按钮</title>
<style type="text/css">
<!--
body { font-family: "宋体"; font-size: 9pt; margin-top: 0px; margin-left: 4px; margin-right: 0px}
A { COLOR: black; FONT-SIZE: 13px; FONT-WEIGHT: 400; TEXT-DECORATION: none }
A:hover { COLOR: red; FONT-SIZE: 13px; FONT-WEIGHT: 400; TEXT-DECORATION: underline }
a:active { font: 9pt "宋体"; cursor: hand; color: #FF0033 }
--></style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<br>
<br>
<center><font color=red face="隶书" size=6>按钮驱动背景变化</font></center>
<br>
<center>
<table border=1 bordercolor=#000000 borderlight=green style="border-collapse: collapse" cellpadding="0" cellspacing="0">
<tr><td align=center><font size=5 color=red face="Arial, Helvetica, sans-serif"><strong>下面框中为脚本显示区</strong></font></td></tr>
<tr><td align=center height=80>
<script language="JavaScript">
var COLOR = 999999
var woot = 0
function stoploop()
{
document.bgColor = '#336699';
clearTimeout(loopID);
}
function loopBackground()
{
if (COLOR > 0)
{
document.bgColor = '#' + COLOR
COLOR -= 111111
loopID = setTimeout("loopBackground()",1)
}
else
{
document.bgColor = '#336699'
woot += 10
COLOR = 999999
COLOR -= woot
loopID = setTimeout("loopBackground()",1)
}
}
</script>
 <input type="button" value="开始背景变化" onClick="loopBackground()"><br>
 <input type="button" value="结束背景变化" onClick="stoploop()">
</td></tr></table></center>
<br>
<br>
<center>

<SCRIPT LANGUAGE="JavaScript">

<!-- hide
function goHist(a)
{
history.go(a);
}
//-->
</script>
</center>
<br>
<center>
&nbsp;<br>
<br>
</body>
</html>
«Newer      Older»
Comment:
Name:

Back to home

Subscribe | Register | Login | N