第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

第五個(gè)沒(méi)有反應(yīng),求救各位老師,前輩

<!DOCTYPE HTML>

<html>

<head>

<meta http-equiv="Content-Type" Content="text/html; charset=utf-8" />

<title>javascript</title>

<style type="text/css">

body{font-size:12px;}

#txt{

? ? height:400px;

? ? width:600px;

border:#333 solid 1px;

padding:5px;}

p{

line-height:18px;

text-indent:2em;}

</style>

</head>

<body>

? <h2 id="con">JavaScript課程</H2>

? <div id="txt" class="abc">?

? ? ?<h5>JavaScript為網(wǎng)頁(yè)添加動(dòng)態(tài)效果并實(shí)現(xiàn)與用戶(hù)交互的功能。</h5>

? ? ? ? <p>1. JavaScript入門(mén)篇,讓不懂JS的你,快速了解JS。</p>

? ? ? ? <p>2. JavaScript進(jìn)階篇,讓你掌握J(rèn)S的基礎(chǔ)語(yǔ)法、函數(shù)、數(shù)組、事件、內(nèi)置對(duì)象、BOM瀏覽器、DOM操作。</p>

? ? ? ? <p>3. 學(xué)完以上兩門(mén)基礎(chǔ)課后,在深入學(xué)習(xí)JavaScript的變量作用域、事件、對(duì)象、運(yùn)動(dòng)、cookie、正則表達(dá)式、ajax等課程。</p>

? </div>

? <form>

? <!--當(dāng)點(diǎn)擊相應(yīng)按鈕,執(zhí)行相應(yīng)操作,為按鈕添加相應(yīng)事件-->

? ? <input type="button" value="改變顏色" onclick="changeclor()">??

? ? <input type="button" value="改變寬高" onclick="changeihg()">

? ? <input type="button" value="隱藏內(nèi)容" onclick="changedcs()">

? ? <input type="button" value="顯示內(nèi)容" onclick="changetgd()">

? ? <input type="button" value="取消設(shè)置" onClick="hey()">

? </form>

? <script type="text/javascript">

//定義"改變顏色"的函數(shù)

function changeclor(){

var changClor=document.getElementById("txt");

var changbg=document.getElementById("con");

changClor.style.color="blue";

changbg.style.backgroundColor="grey";}

//定義"改變寬高"的函數(shù)

function changeihg(){

var changh=document.getElementById("txt");

changh.style.height="500px";

var changw=document.getElementById("txt");

changw.style.width="700px";}

//定義"隱藏內(nèi)容"的函數(shù)

function changedcs(){

var hideen=document.getElementById('txt');

hideen.style.display="none";}


//定義"顯示內(nèi)容"的函數(shù)

function changetgd(){

var shou=document.getElementById("txt");

shou.style.display="block";}

//定義"取消設(shè)置"的函數(shù)

function hey(){

? ? var reutnb=confirm("取消嗎");

? ?if(reutnb==true){

? ? ? ?changClor.style.color="blue";

? ? ? changh.style.height="500px";

? ?}

? ?else{

? ? ? reutnb.className="abc";

? ?}

}


正在回答

8 回答

主要是因?yàn)閏hangClor和changh這兩個(gè)對(duì)象是在changeclor()函數(shù)內(nèi)定義的。用我下面這個(gè)就沒(méi)問(wèn)題了

function?cancel(){	var?can=confirm("是否取消設(shè)置");	if(can){		var?re=document.getElementById("txt");		re.removeAttribute('style');	}}


0 回復(fù) 有任何疑惑可以回復(fù)我~

能幫我看一下這是哪錯(cuò)了嗎,第三四五個(gè)功能都運(yùn)行不出來(lái),謝謝



<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8" />
<title>javascript</title>
<style type="text/css">
body{font-size:12px;}
#txt{
??? height:400px;
??? width:600px;
?border:#333 solid 1px;
?padding:5px;}
p{
?line-height:18px;
?text-indent:2em;}
</style>
</head>
<body>
? <h2 id="con">JavaScript課程</H2>
? <div id="txt">
???? <h5>JavaScript為網(wǎng)頁(yè)添加動(dòng)態(tài)效果并實(shí)現(xiàn)與用戶(hù)交互的功能。</h5>
??????? <p>1. JavaScript入門(mén)篇,讓不懂JS的你,快速了解JS。</p>
??????? <p>2. JavaScript進(jìn)階篇,讓你掌握J(rèn)S的基礎(chǔ)語(yǔ)法、函數(shù)、數(shù)組、事件、內(nèi)置對(duì)象、BOM瀏覽器、DOM操作。</p>
??????? <p>3. 學(xué)完以上兩門(mén)基礎(chǔ)課后,在深入學(xué)習(xí)JavaScript的變量作用域、事件、對(duì)象、運(yùn)動(dòng)、cookie、正則表達(dá)式、ajax等課程。</p>
? </div>
? <form>
? <!--當(dāng)點(diǎn)擊相應(yīng)按鈕,執(zhí)行相應(yīng)操作,為按鈕添加相應(yīng)事件-->
??? <input type="button" value="改變顏色" onclick=add()>?
??? <input type="button" value="改變寬高" onclick=add1()>
??? <input type="button" value="隱藏內(nèi)容" oncilck=add2()>
??? <input type="button" value="顯示內(nèi)容" oncilck=add3()>
??? <input type="button" value="取消設(shè)置" oncilck=add4()>
? </form>
? <script type="text/javascript">
//定義"改變顏色"的函數(shù)
var kxf = document.getElementById("txt");
?function add(){
????? kxf.style.color="red";
????? kxf.style.backgroundColor="#ccc";
??? }
//定義"改變寬高"的函數(shù)
function add1(){
??? kxf.style.width="500px";
??? kxf.style.height="500px";
}
//定義"隱藏內(nèi)容"的函數(shù)
function add2(){
kxf.style.display="none";
}
//定義"顯示內(nèi)容"的函數(shù)
function add3(){
kxf.style.display="block";
}
//定義"取消設(shè)置"的函數(shù)
function add4(){
??????? if(confirm("是否取消所有設(shè)置")==true){
??????????? kxf.style.color = "#000000";
??????????? kxf.style.width = "600px";
??????????? kxf.style.display = "block";
??????? }
?? }
? </script>
</body>
</html>

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

qq_Cross_heart_0

兄弟,從第三個(gè)按鈕寫(xiě)錯(cuò)了啊,下面沒(méi)問(wèn)題,onclick.你寫(xiě)的是oncilck.看仔細(xì)點(diǎn)。
2019-05-31 回復(fù) 有任何疑惑可以回復(fù)我~

/*哦,我收回剛才說(shuō)的話,不是調(diào)用的問(wèn)題,你復(fù)制代碼的時(shí)候丟了最后兩個(gè)標(biāo)簽,我沒(méi)看見(jiàn),你最后的hey函數(shù)沒(méi)調(diào)用成功是因?yàn)槟?,沒(méi)在函數(shù)里面聲明變量,這是我按著你的思路給你改了一下,你看看。*/

<!DOCTYPE?HTML>

<html>

<head>

????<meta?http-equiv="Content-Type"?Content="text/html;?charset=utf-8"?/>

????<title>javascript</title>

????<style?type="text/css">

????????body{font-size:12px;}

????????#txt{

????????????height:400px;

????????????width:600px;

????????????border:#333?solid?1px;

????????????padding:5px;}

????????p{

????????????line-height:18px;

????????????text-indent:2em;}

????</style>

</head>

<body>

<h2?id="con">JavaScript課程</H2>

<div?id="txt"?class="abc">

????<h5>JavaScript為網(wǎng)頁(yè)添加動(dòng)態(tài)效果并實(shí)現(xiàn)與用戶(hù)交互的功能。</h5>

????<p>1.?JavaScript入門(mén)篇,讓不懂JS的你,快速了解JS。</p>

????<p>2.?JavaScript進(jìn)階篇,讓你掌握J(rèn)S的基礎(chǔ)語(yǔ)法、函數(shù)、數(shù)組、事件、內(nèi)置對(duì)象、BOM瀏覽器、DOM操作。</p>

????<p>3.?學(xué)完以上兩門(mén)基礎(chǔ)課后,在深入學(xué)習(xí)JavaScript的變量作用域、事件、對(duì)象、運(yùn)動(dòng)、cookie、正則表達(dá)式、ajax等課程。</p>

</div>

<form>

????<!--當(dāng)點(diǎn)擊相應(yīng)按鈕,執(zhí)行相應(yīng)操作,為按鈕添加相應(yīng)事件-->

????<input?type="button"?value="改變顏色"?onclick="changeclor()">

????<input?type="button"?value="改變寬高"?onclick="changeihg()">

????<input?type="button"?value="隱藏內(nèi)容"?onclick="changedcs()">

????<input?type="button"?value="顯示內(nèi)容"?onclick="changetgd()">

????<input?type="button"?value="取消設(shè)置"?onClick="hey()">

</form>

<script?type="text/javascript">

????//定義"改變顏色"的函數(shù)

????function?changeclor(){

????????var?changClor=document.getElementById("txt");

????????var?changbg=document.getElementById("con");

????????changClor.style.color="blue";

????????changbg.style.backgroundColor="grey";}

????//定義"改變寬高"的函數(shù)

????function?changeihg(){

????????var?changh=document.getElementById("txt");

????????changh.style.height="500px";

????????var?changw=document.getElementById("txt");

????????changw.style.width="700px";}

????//定義"隱藏內(nèi)容"的函數(shù)

????function?changedcs(){

????????var?hideen=document.getElementById('txt');

????????hideen.style.display="none";}



????//定義"顯示內(nèi)容"的函數(shù)

????function?changetgd(){

????????var?shou=document.getElementById("txt");

????????shou.style.display="block";}

????//定義"取消設(shè)置"的函數(shù)

????function?hey(){

????????var?reutnb=confirm("取消嗎");

???if(reutnb==true){
???????var?changClor=document.getElementById("txt");
???????var?changh=document.getElementById("txt");
???????changClor.style.color="#333";
???????changh.style.height="400";
???????changClor.style.display="block";

???}

???else{

???????reutnb.className="abc";

???}

????}
????</script>
</body>
</html>


0 回復(fù) 有任何疑惑可以回復(fù)我~

兄dei,你發(fā)的代碼不只是第五個(gè)按鈕不好使,所有的都用不了,里面有的符號(hào)還是中文符號(hào),你好好檢查檢查,另外你沒(méi)運(yùn)行成功的原因是因?yàn)槟愕淖兞繂?wèn)題,你把聲明寫(xiě)都函數(shù)里面,他只作用到當(dāng)前函數(shù),然后你在第一個(gè)函數(shù)寫(xiě)了一個(gè)聲明,在最后一個(gè)函數(shù)又重復(fù)聲明,就會(huì)報(bào)錯(cuò),你要么把聲明拿出來(lái),要么放到第一個(gè)函數(shù)的聲明不要嘗試在其他函數(shù)里面調(diào)用,那是調(diào)不到的。

0 回復(fù) 有任何疑惑可以回復(fù)我~
//你直接復(fù)制參考下我的代碼
<!DOCTYPE?HTML>
<html>
<head>
????<meta?http-equiv="Content-Type"?Content="text/html;?charset=utf-8"?/>
????<title>javascript</title>
????<style?type="text/css">
????????body{font-size:12px;}
????????#txt{
????????????height:400px;
????????????width:600px;
????????????border:#333?solid?1px;
????????????padding:5px;}
????????p{
????????????line-height:18px;
????????????text-indent:2em;}

????</style>
</head>
<body>
<h2?id="con">JavaScript課程</H2>
<div?id="txt">
????<h5>JavaScript為網(wǎng)頁(yè)添加動(dòng)態(tài)效果并實(shí)現(xiàn)與用戶(hù)交互的功能。</h5>
????<p>1.?JavaScript入門(mén)篇,讓不懂JS的你,快速了解JS。</p>
????<p>2.?JavaScript進(jìn)階篇,讓你掌握J(rèn)S的基礎(chǔ)語(yǔ)法、函數(shù)、數(shù)組、事件、內(nèi)置對(duì)象、BOM瀏覽器、DOM操作。</p>
????<p>3.?學(xué)完以上兩門(mén)基礎(chǔ)課后,在深入學(xué)習(xí)JavaScript的變量作用域、事件、對(duì)象、運(yùn)動(dòng)、cookie、正則表達(dá)式、ajax等課程。</p>
</div>
<form>
????<!--當(dāng)點(diǎn)擊相應(yīng)按鈕,執(zhí)行相應(yīng)操作,為按鈕添加相應(yīng)事件-->
????<input?type="button"?value="改變顏色"?onclick="col()">
????<input?id="btnW"?type="button"?value="改變寬高"?onclick="wid()">
????<input?id="btnH"?type="button"?value="隱藏內(nèi)容"?onclick="hid()">
????<input?id="btnB"?type="button"?value="顯示內(nèi)容"?onclick="blo()">
????<input?id="btnCan"?type="button"?value="取消設(shè)置"?onclick="cancel()"?>
</form>
<script?type="text/javascript">
????var?oCon?=?document.getElementById("con");
????var?oTxt?=?document.getElementById("txt");
????//定義"改變顏色"的函數(shù)
????function?col(){
????????oTxt.style.color?=?"red";
????}
????//定義"改變寬高"的函數(shù)
????function?wid(){
????????oTxt.style.width?=?"300px";
????}
????//定義"隱藏內(nèi)容"的函數(shù)
????function?hid(){
????????oTxt.style.display?=?"none";
????}
????//定義"顯示內(nèi)容"的函數(shù)
????function?blo(){
????????oTxt.style.display?=?"block";
????}
????//定義"取消設(shè)置"的函數(shù)
????function?cancel(){
????????if(confirm("是否取消所有設(shè)置")==true){
????????????oTxt.style.color?=?"#000000";
????????????oTxt.style.width?=?"600px";
????????????oTxt.style.display?=?"block";
????????}
????}


</script>
</body>
</html>


0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

weixin_慕移動(dòng)6257819

if(confirm("是否取消所有設(shè)置")==true),confirm("是否取消所有設(shè)置")不是自帶真假值,干嘛還去判斷真假?
2019-05-29 回復(fù) 有任何疑惑可以回復(fù)我~

?changClor.style.color="blue";

? ? ? changh.style.height="500px";

你changClor和changh前面要用var,如果不想每次在新的funcation里面重復(fù)使用一個(gè)元素時(shí)前面都要加var就要把var?changClor和var?changh變成全局變量,放在所有function的外面:

<script type="text/javascript">

var?changClor;

var?changh;

function XXX(){

changClor=XXX;

changh=XXX;

...

}

function XXX(){

changClor=XXX;

changh=XXX;

...

}


function XXX(){

changClor=XXX;

changh=XXX;

...

}

</script>


0 回復(fù) 有任何疑惑可以回復(fù)我~

你的://定義"隱藏內(nèi)容"的函數(shù)的 txt用的單引號(hào)改成雙引號(hào)

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

慕移動(dòng)8517387

雙或單沒(méi)事的,并不影響最終的輸出
2019-06-13 回復(fù) 有任何疑惑可以回復(fù)我~

等我做完就來(lái)回答你 我也是0基礎(chǔ)在學(xué)習(xí)

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

第五個(gè)沒(méi)有反應(yīng),求救各位老師,前輩

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)