語法展示:: http://home.graffiti.net/khtfjkgvj/
請用IE6.0或更新版本觀看語法特效展示
將以下程式碼複製,貼在<body>及</body>標籤之間。
<center>
<form name="backcolorform">請選擇背景顏色<br>
<table cellpadding="5" cellspacing="5" border="0">
<tr bgcolor="#FF8080">
<td>
<input type="radio" name="color" value="#FF8080" onClick="backcolor(this.form)">
</td>
<td bgcolor="#FFEAD5">
<input type="radio" name="color" value="#FFEAD5" onClick="backcolor(this.form)">
</td>
<td bgcolor="#FFFF00">
<input type="radio" name="color" value="#FFFF00" onClick="backcolor(this.form)">
</td>
<td bgcolor="#80FF00">
<input type="radio" name="color" value="#80FF00" onClick="backcolor(this.form)">
</td>
</tr>
<tr>
<td bgcolor="#00FF00">
<input type="radio" name="color" value="#00FF00" onClick="backcolor(this.form)">
</td>
<td bgcolor="#00FF80">
<input type="radio" name="color" value="#00FF80" onClick="backcolor(this.form)">
</td>
<td bgcolor="#00FFFF">
<input type="radio" name="color" value="#00FFFF" onClick="backcolor(this.form)">
</td>
<td bgcolor="#0080FF">
<input type="radio" name="color" value="#0080FF" onClick="backcolor(this.form)">
</td>
</tr>
<tr>
<td bgcolor="#8080FF">
<input type="radio" name="color" value="#8080FF" onClick="backcolor(this.form)">
</td>
<td bgcolor="#BF80FF">
<input type="radio" name="color" value="#BF80FF" onClick="backcolor(this.form)">
</td>
<td bgcolor="#FF00FF">
<input type="radio" name="color" value="#FF00FF" onClick="backcolor(this.form)">
</td>
<td bgcolor="#FF0080">
<input type="radio" name="color" value="#FF0080" onClick="backcolor(this.form)">
</td>
</tr>
<tr>
<td bgcolor="#000000">
<input type="radio" name="color" value="#000000" onClick="backcolor(this.form)">
</td>
<td bgcolor="#FFFFFF">
<input type="radio" name="color" value="#FFFFFF" onClick="backcolor(this.form)">
</td>
<td bgcolor="#800000">
<input type="radio" name="color" value="#800000" onClick="backcolor(this.form)">
</td>
<td bgcolor="#BF80FF">
<input type="radio" name="color" value="#BF80FF" onClick="backcolor(this.form)">
</td>
</tr>
</table>
</form>
</center>
將以下程式碼複製,貼在<head>及</head>標籤之間。
<script language="Javascript">
<!--
function backcolor(form){
temp = ""
for (var i = 0; i < 16; i++) {
temp = form.color[i].value
if (form.color[i].checked){ document.bgColor = temp }
}
}
function randombackground(){
document.bgColor = getColor()
}
function getColor(){
currentdate = new Date()
backgroundcolor = currentdate.getSeconds()
if (backgroundcolor > 44)
backgroundcolor = backgroundcolor - 45
else if (backgroundcolor > 29)
backgroundcolor = backgroundcolor - 30
else if (backgroundcolor > 15)
backgroundcolor = backgroundcolor - 16
if (backgroundcolor == 0 )
return "olive";
else if (backgroundcolor == 1 )
return "teal";
else if (backgroundcolor == 2 )
return "red";
else if (backgroundcolor == 3 )
return "blue";
else if (backgroundcolor == 4 )
return "maroon";
else if (backgroundcolor == 5 )
return "navy";
else if (backgroundcolor == 6 )
return "lime";
else if (backgroundcolor == 7 )
return "fuschia";
else if (backgroundcolor == 8 )
return "green";
else if (backgroundcolor == 9 )
return "purple";
else if (backgroundcolor == 10 )
return "gray";
else if (backgroundcolor == 11 )
return "yellow";
else if (backgroundcolor == 12 )
return "aqua";
else if (backgroundcolor == 13 )
return "black";
else if (backgroundcolor == 14 )
return "white";
else if (backgroundcolor == 15 )
return "silver";
}
-->
</script>
留言列表