交作業,順便問一下有沒有大佬知道哪個js命令是清空gb()所做的修改的
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>style樣式</title>
<script type="text/javascript">
? ? function gb(){
? ? ? ? var gb = document.getElementById("con");
? ? ? ? gb.style.color="red";
? ? ? ? gb.style.backgroundColor="#CCC";
? ? }
? ??
? ? function hd(){
? ? ? ? var gb = document.getElementById("con");
? ? ? ? gb.style.display="none";
? ? }
? ??
? ? function sh(){
? ? ? ? var gb = document.getElementById("con");
? ? ? ? gb.style.display="block";
? ? }
?</script>
</head>
<body>
? <h2 id="con">I love JavaScript</H2>
? <p id="txt"> JavaScript使網頁顯示動態效果并實現與用戶交互功能。</p>
? <input type="button" value="換色" onclick="gb()" />
? <input type="button" value="隱藏" onclick="hd()" />
? <input type="button" value="顯示" onclick="sh()" />
</body>
</html>
2020-06-26
gd.style=""
這樣就行了
2020-06-26
可以了!