classname属性,不知道哪里有错
<html>
<head><title>classname属性</title>
<style type="text/css">
input{
font-size:10px;
}
.one{
width:200px;
background-color:#CCC;
}
.two{
font-size:18px;
color:#FOO;
}
</style>
</head>
<body>
<h1 id="con" class="one">Javascript</h1>
<form>
<input type="button" value="点击更改" onclick="modifyclass()">
</form>
<script type="text/javascript">
var mystr=getelementbyid("con");
document.write("p元素的class值为:"+mystr.classname);
function modifyclass(){
mystr.classname=two;
}
</script>
</body>
</html>