我想设置点击完按钮以后,他会显示"p元素class值为two"..但是我的代码显示不了,有大神指点下吗?
<style type="text/css">
input{
font-size:10px;
}
.one{
width:200px;
}
.two{
font-size:18px;
color:#F00;
}
</style>
</head>
<body>
<p id="con" class="one">JavaScript</p>
<form>
<input type="button" value="点击更改" onclick="modifyclass()">
</form>
<script type="text/javascript">
var mychar=document.getElementById("con");
document.write("p元素Class值为:" + mychar.className+"</br>")
function modifyclass(){
mychar.className="two";
document.mychar.innerHTML("p元素Class值为:two");
}
</script>