求大神帮解答一下,为什么我写的代码,第二个按钮没有将css twov的样式附加到ID为box2上
如题,同时火狐还提示“
预期为声明,但却得到 '.'。 跳过至下一个声明。 html4.e01.html:15
搜索 声明区的闭合 } 时遇到不期望的文件结束符。
”这样的文字。谢谢
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">
.two{
border:1px solid #ccc;
width:230px;
height:50px;
background:#9CF;
color:blue;
.twov{
border:3px solid #ccc;
width:430px;
height:230px;
background:#eCF;
color:blue;
}
</style>
<script type="text/javascript">
function odiva(){
var p1=document.getElementById("box2");
p1.className="two";
};
function odivb(){
var p2=document.getElementById("box2");
p2.className="twov";
};
</script>
</head>
<body>
<div id="box2">
这个是一段文字内容;
</div>
<button type="button" onclick="odiva()">这个是按钮</button>
<button type="button" onclick="odivb()">第二按钮</button>
</body>
</html>