怎么样能让“点击更改”后“p元素class值为:one”变为two?
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>className属性</title>
<style type="text/css">
input{
font-size: 10px;
}
.one{
width:200px;
background-color: #CCC;
}
.two{
font-size: 18px;
color:#F00;
}
</style>
</head>
<body>
<p id="con" class="one">JavaScript</p>
<form>
<input type="button" name="button" onclick="modifyclass()" value="点击更改" />
</form>
<script type="text/javascript">
var mychar=document.getElementById("con");
document.write("P元素Class值为:"+mychar.className+"<br>");
function modifyclass(){
mychar.className="two";
}
</script>
</body>
</html>