A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 闫常国 中级黑马   /  2013-4-27 11:13  /  1565 人查看  /  1 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

<!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=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function changeColor(){
  var btnSwitch=document.getElementById("sw");
  if(document.body.className="day"){
   document.body.className="night";
   btnSwitch.value="开灯";
   }
  else{
   document.body.className="day";
   btnSwitch.value="关灯";
   }
  }
</script>
<style type="text/css">
.day{
  background-color:#FFF;
  }
.night{
  background-color:#000;
  }
</style>
</head>
<body class="day">
<input id="sw" type="button" value="关灯" />
</body>
</html>

评分

参与人数 1技术分 +1 收起 理由
苏波 + 1

查看全部评分

1 个回复

倒序浏览
用jQuery写吧
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马