課程
/前端開(kāi)發(fā)
/JavaScript
/JavaScript進(jìn)階篇
大佬們幫我看一下
2018-07-05
源自:JavaScript進(jìn)階篇 9-1
正在回答
display寫(xiě)錯(cuò)了
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>style樣式</title>
</head>
<body>
? <h2 id="con" onclick="cc()">I love JavaScript</H2>
? <p> JavaScript使網(wǎng)頁(yè)顯示動(dòng)態(tài)效果并實(shí)現(xiàn)與用戶(hù)交互功能。</p>
? <script type="text/javascript">
? ?var clr=document.getElementById("con");
? ?clr.style.color="red";
? ?clr.style.backgroundColor="#ccc";
? ?function cc(){
? ? ? ?clr.style.display="none"
? ?}
?
? </script>
</body>
</html>
display 你寫(xiě)成diaplay了。。。
為什么是單引號(hào)的
為什么一定要寫(xiě)到函數(shù)里呢,我記得JavaScript入門(mén)篇最后那個(gè)練習(xí)沒(méi)有把獲取id這些語(yǔ)句寫(xiě)進(jìn)去
qq_丿iTTF鷹_0
慕粉1474278593
<meta http-equiv="Content-Type" content="text/html;">
<meta charset="UTF-8">
<title>style 樣 式 </title>
<h2 id="con">l love ]avaScript</h2>
<p> JavaScript使網(wǎng)頁(yè)顯示動(dòng)態(tài)效桌并實(shí)現(xiàn)與用戶(hù)交互功能。</p>
<script type="text/javascript">
function mydisplay() {
var mycha = document.getElementById('con');
mycha.style.color = 'red';
mycha.style.backgroundColor = '#CCC';
mycha.style.display = 'none';
}
</script>
<input type="button" value="隱藏內(nèi)容" onclick='mydisplay()'>
你的獲取的id 的那些語(yǔ)句 寫(xiě)在函數(shù)里面 就行了??
qq_啦啦啦啦_5 提問(wèn)者
鑌鐵腦殼
qq_丿iTTF鷹_0 回復(fù) 鑌鐵腦殼
qq_丿iTTF鷹_0 回復(fù) qq_啦啦啦啦_5 提問(wèn)者
慕粉1474278593 回復(fù) qq_丿iTTF鷹_0
舉報(bào)
本課程從如何插入JS代碼開(kāi)始,帶您進(jìn)入網(wǎng)頁(yè)動(dòng)態(tài)交互世界
1 回答為什么我不能隱藏
4 回答為什么運(yùn)行時(shí)oDiv的內(nèi)容全部隱藏了
1 回答怎么隱藏document輸出的內(nèi)容? 用一個(gè)按鈕;
2 回答為啥這樣不能實(shí)現(xiàn)隱藏
1 回答為什么找到了P標(biāo)簽,但是不能隱藏呢?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢(xún)優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2018-12-08
display寫(xiě)錯(cuò)了
2018-08-06
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>style樣式</title>
</head>
<body>
? <h2 id="con" onclick="cc()">I love JavaScript</H2>
? <p> JavaScript使網(wǎng)頁(yè)顯示動(dòng)態(tài)效果并實(shí)現(xiàn)與用戶(hù)交互功能。</p>
? <script type="text/javascript">
? ?var clr=document.getElementById("con");
? ?clr.style.color="red";
? ?clr.style.backgroundColor="#ccc";
? ?function cc(){
? ? ? ?clr.style.display="none"
? ?}
?
?
? </script>
</body>
</html>
2018-07-16
display 你寫(xiě)成diaplay了。。。
2018-07-08
為什么是單引號(hào)的
2018-07-05
為什么一定要寫(xiě)到函數(shù)里呢,我記得JavaScript入門(mén)篇最后那個(gè)練習(xí)沒(méi)有把獲取id這些語(yǔ)句寫(xiě)進(jìn)去
2018-07-05
<head>
<meta http-equiv="Content-Type" content="text/html;">
<meta charset="UTF-8">
<title>style 樣 式 </title>
</head>
<body>
<h2 id="con">l love ]avaScript</h2>
<p> JavaScript使網(wǎng)頁(yè)顯示動(dòng)態(tài)效桌并實(shí)現(xiàn)與用戶(hù)交互功能。</p>
<script type="text/javascript">
function mydisplay() {
var mycha = document.getElementById('con');
mycha.style.color = 'red';
mycha.style.backgroundColor = '#CCC';
mycha.style.display = 'none';
}
</script>
<input type="button" value="隱藏內(nèi)容" onclick='mydisplay()'>
</body>
</html>
2018-07-05
你的獲取的id 的那些語(yǔ)句 寫(xiě)在函數(shù)里面 就行了??