这样写会不会有问题,正确的格式该怎么写
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>style样式</title>
</head>
<body>
<h2 id="con" onClick="yc()">I love JavaScript</H2>
<p onClick="xs()"> JavaScript使网页显示动态效果并实现与用户交互功能。</p>
<script type="text/javascript">
var gb=document.getElementById("con");
gb.style.color="red";
gb.style.backgroundColor="#ccc";
function yc(){
gb.style.display="none";
}
function xs(){
gb.style.display="block";
}
</script>
</body>
</html>