課程
/前端開發(fā)
/JavaScript
/JavaScript入門篇
真正輸出的結(jié)果是什么?怎么代碼換了,輸出結(jié)果變了,但是系統(tǒng)都給通過了,暈菜
2016-07-07
源自:JavaScript入門篇 3-2
正在回答
JavaScript
結(jié)果:[object HTMLParagraphElement]
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>className屬性</title>
<style>
? ? body{ font-size:16px;}
? ? .one{
border:1px solid #eee;
width:230px;
height:50px;
background:#ccc;
color:red;
? ? }
.two{
border:1px solid #ccc;
background:#9CF;
color:blue;
}
</style>
</head>
<body>
? ? <p id="p1" > JavaScript使網(wǎng)頁顯示動態(tài)效果并實(shí)現(xiàn)與用戶交互功能。</p>
? ? <input type="button" value="添加樣式" onclick="add()"/>
<p id="p2" class="one">JavaScript使網(wǎng)頁顯示動態(tài)效果并實(shí)現(xiàn)與用戶交互功能。</p>
? ? <input type="button" value="更改外觀" onclick="modify()"/>
<script type="text/javascript">
? function add(){
? ? ?var p1 = document.getElementById("p1");
? ? ? ?p1.className="one"
? }
? function modify(){
? ? ?var p2 = document.getElementById("p2");
? ? ?p2.className="two"
</script>
</body>
</html>
舉報(bào)
JavaScript做為一名Web工程師的必備技術(shù),本教程讓您快速入門
3 回答這個(gè)代碼正確嗎?
1 回答這個(gè)代碼正確嗎?
3 回答正確代碼有嗎
5 回答這節(jié)課代碼到底是啥?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2016-07-09
JavaScript
結(jié)果:[object HTMLParagraphElement]
2016-07-07
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>className屬性</title>
<style>
? ? body{ font-size:16px;}
? ? .one{
border:1px solid #eee;
width:230px;
height:50px;
background:#ccc;
color:red;
? ? }
.two{
border:1px solid #ccc;
width:230px;
height:50px;
background:#9CF;
color:blue;
}
</style>
</head>
<body>
? ? <p id="p1" > JavaScript使網(wǎng)頁顯示動態(tài)效果并實(shí)現(xiàn)與用戶交互功能。</p>
? ? <input type="button" value="添加樣式" onclick="add()"/>
<p id="p2" class="one">JavaScript使網(wǎng)頁顯示動態(tài)效果并實(shí)現(xiàn)與用戶交互功能。</p>
? ? <input type="button" value="更改外觀" onclick="modify()"/>
<script type="text/javascript">
? function add(){
? ? ?var p1 = document.getElementById("p1");
? ? ? ?p1.className="one"
? }
? function modify(){
? ? ?var p2 = document.getElementById("p2");
? ? ?p2.className="two"
? }
</script>
</body>
</html>