id和变量名都可以,怎么才规范?为什么?
<!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">
var mychar= document.getElementById("con");
mychar.style.color="red";
mychar.style.fontSize="38px";
mychar.style.backgroundColor="#CCC";
mychar.style.width="300px";
var abc=document.getElementById("con");
abc.style.color="blue";
con.style.fontSize="18px";
con.style.backgroundColor="red";
abc.style.width="150px";
</script>
</body>
</html>