字体大小怎么改变不了
输入mychar.style.fontSize="20";怎么没变化,求解?
2016-09-13
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>style样式</title>
</head>
<body>
<h2 id="con">I love JavaScript</H2>
<p> JavaScript使网页显示动态效果并实现与用户交互功能。</p>
<script type="text/javascript">
function gb(){
var mychar= document.getElementById("con");
mychar.style.color="red";
mychar.style.background="#ccc";
mychar.style.width="300px";
mychar.style.height="30px"
mychar.style.fontSize="20px";}
</script>
<input type="button" value="变化" onclick="gb>
</body>
</html>
举报