<!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">
</script>
<style type="text/css">
.day{
background-color:while;
}
.neight{
background-color:black;
}
</style>
<script type="text/javascript">
function switcLight(){
var btnSwitch = document.getElementById('btnSwitch');
if(document.body.className == 'day'){
document.body.className = "neight";
btnSwitch.value="开灯";
}else{
document.body.className = "day";
btnSwitch.value="关灯";
}
}
</script>
</head>
<body class="neight">
<input type="button" id="btnSwitch" value="开灯" οnclick="switcLight()"/>
</body>
</html>
<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">
</script>
<style type="text/css">
.day{
background-color:while;
}
.neight{
background-color:black;
}
</style>
<script type="text/javascript">
function switcLight(){
var btnSwitch = document.getElementById('btnSwitch');
if(document.body.className == 'day'){
document.body.className = "neight";
btnSwitch.value="开灯";
}else{
document.body.className = "day";
btnSwitch.value="关灯";
}
}
</script>
</head>
<body class="neight">
<input type="button" id="btnSwitch" value="开灯" οnclick="switcLight()"/>
</body>
</html>