<form name="myForm">
<P><INPUT type="button" value="红" onClick="ChangeBgColor(‘red‘)"></P>
<P><INPUT type="button" value="蓝" onClick="ChangeBgColor(‘blue‘)"></P>
<P><INPUT type="button" value="绿" onClick="ChangeBgColor(‘green‘)"></P>
</form>
<script language="javascript">
function ChangeBgColor(new_bgcolor)
{
var myform1=document.myForm;
myform1.style.background=new_bgcolor;
}
</script>
时间: 2024-11-08 21:59:17