js怎么设置按钮控制背景颜色
1、<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN媪青怍牙" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>js实现点击按钮变换背景颜色</title><script type="text/javascript">function aa(){document.bgColor="Orange";}
2、function change(c){document.bgColor=c;}</script></head>
3、<body onload="aa()"><挢旗扦渌;input type="button" value="橙色" onclick="change('Orange')"/><input type="button" value="粉色" onclick="change('pink')"/><input type="button" value="绿色" onclick="change('green')"/>
4、<br /><br/></body></html>
5、以上就是所有的代码,因为经验的要求,小编给拆分了,大家可以复制在一起使用。
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。