按钮样式
复制代码 代码如下:
<script>
org_Color=document
bgColor
substring(
)
</script>
<form>
<input type="button" value="淡黄色背景"onClick="document
bgColor=
#feffc
">
<input type="button" value="浅蓝色背景"onClick="document
bgColor=
#c
fffe
">
<input type="button" value="粉红色背景"onClick="document
bgColor=
#ffc
c
">
<input type="button" value="墨绿色背景"onClick="document
bgColor=
#
b
d
">
<input type="button" value="天蓝色背景"onClick="document
bgColor=
#
BC
FF
">
<input type="button" value="米白色背景"onClick="document
bgColor=
#f
f
f
">
</form>
下拉样式
复制代码 代码如下:
<selectonChange="document
bgColor=this
options[this
selectedIndex]
value">
<option value="#C
C
C
">灰色的
<option value="BLACK">黑的色
<option value="d
c
ff">淡紫蓝
<option value="feefc
">太阳黄
<option value="ffd
c
">淡红橘
<option value="c
fed
">苹果绿
<option value="
ff
">草原绿
<option value="#C
BC
">橄榄色
<option value="#
BC
FF">天空蓝
<option value="#AEDFD
">蓝绿色
<option value="#
B
D">墨绿色
<option value="#F
F
F
">米白色
</select>
触碰样式
复制代码 代码如下:
<scriptlanguage="Javascript">
<!
function backcolor(form){
temp = ""
for (var i =
; i <
; i++) {
temp = form
color[i]
value
if (form
color[i]
checked){ document
bgColor = temp }
}
}
function randombackground(){
documentbgColor = getColor()
}
function getColor(){
currentdate = new Date()
backgroundcolor = currentdategetSeconds()
if (backgroundcolor > )
backgroundcolor = backgroundcolor
else if (backgroundcolor > )
backgroundcolor = backgroundcolor
else if (backgroundcolor > )
backgroundcolor = backgroundcolor
if (backgroundcolor == )
return "olive";
else if (backgroundcolor == )
return "teal";
else if (backgroundcolor == )
return "red";
else if (backgroundcolor == )
return "blue";
else if (backgroundcolor == )
return "maroon";
else if (backgroundcolor == )
return "navy";
else if (backgroundcolor == )
return "lime";
else if (backgroundcolor == )
return "fuschia";
else if (backgroundcolor == )
return "green";
else if (backgroundcolor == )
return "purple";
else if (backgroundcolor == )
return "gray";
else if (backgroundcolor == )
return "yellow";
else if (backgroundcolor == )
return "aqua";
else if (backgroundcolor == )
return "black";
else if (backgroundcolor == )
return "white";
else if (backgroundcolor == )
return "silver";
}
// >
</script>
<body onload="documentbgColor=lime; returntrue;">
<a href="javascript:void();"onmouseover="randombackground()"><fontsize="" face="宋体">碰我改变背景颜色</font></a>
点击更换背景图片
复制代码 代码如下:
<div style="float:right;margin
right:
px;">
<ahref="javascript:void(
);"><imgclass="button
"onClick="javascript:document
body
style
background=
url(images/bg/
jpg)
"></a>
<ahref="javascript:void(
);"><imgclass="button
"onClick="javascript:document
body
style
background=
url(images/bg/
jpg)
"></a>
<ahref="javascript:void(
);"><imgclass="button
"onClick="javascript:document
body
style
background=
url(images/bg/
jpg)
"></a>
<ahref="javascript:void(
);"><imgclass="button
"onClick="javascript:document
body
style
background=
url(images/bg/
jpg)
"></a>
<ahref="javascript:void(
);"><imgclass="button
"onClick="javascript:document
body
style
background=
url(images/bg/
jpg)
"></a>
<ahref="javascript:void(
);"><imgclass="button
"onClick="javascript:document
body
style
background=
url(images/bg/
jpg)
"></a>
</div>
IE不能用的解决方法
复制代码 代码如下:
<imgonClick="javascript:documentbodystylebackground=url(images/bg/jpg);returnfalse;">