求指點,為什么點button隱藏不了?
<!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 mycon = document.getElementById("con");
? ? mycon.style.color = "red";
? ? mycon.style.backgroundColor = "#CCC";
? ? function hidden(){
? ? ? ? mycon.style.display = "none";
? ? }
? </script>
? <input type="button" value="隱藏h2" onclick="hidden()"/>
</body>
</html>
2019-04-15
//hideen這個函數名和關鍵字hidden沖突了,改下函數名就可以了
?function hidden() {
? ? }