程序补全题——CSS&JavaScript大挑战

来源:百度知道 编辑:UC知道 时间:2024/05/10 01:21:20
在下面的(这里补充)补上缺少的代码。在下列的程序中,用户可以点击红色,绿色等按钮改变其上方层的背景色。(有三个按按钮的 分别是red green blue)因为我的老师很死板,所以一定要两处都补全,不要只补全一个空,虽然只补全一个也可以做出来那样的效果,拜托!(全部的身家都赔上了,不用让我失望,各位真正的高手们)
<html>
<head>
<title>demo</title>
<style type="text/css">
<!--other code-->
#d{border:1px solid gray;width:300px;height:100px;font-size:2em;}
.Red{background:red;}
.Green{background:green;}
.Blue{background:blue;}
<!--other code-->
</style>
<style type="text/javascript">
function cRed(){
var wDiv=(这里补充) ;
wDiv.className="Red";
}
</style>
</head>
<body>
<h3>点击层下面的按钮,可以设置相应的背景色</h3>
<div id="d">DIV Elements</div><br/>
<input type="button" value="red" (这里补充)/>
<!--other code-->
</body>
</html>
<style type="text/

<html>
<head>
<title>demo</title>
<style type="text/css">
#d{border:1px solid gray;width:300px;height:100px;font-size:2em;}
.Red{background:red;}
.Green{background:green;}
.Blue{background:blue;}
</style>
<script type="text/JavaScript">
function cRed(){
var wDiv= document.getElementById("d");
wDiv.className="Red";
}
</script>

</head>

<body>
<h3>点击层下面的按钮,可以设置相应的背景色</h3>
<div id="d">DIV Elements</div><br/>
<input type="button" value="red" onclick="cRed()" />
<!--other code-->
</body>
</html>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<h