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

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

點(diǎn)擊按鈕不起作用

為啥加上改變寬高的函數(shù)之后,點(diǎn)擊任何按鈕都不起作用?

正在回答

5 回答

<!DOCTYPE html>

<html>

? <head>

? ? <title>javascript</title>

<style type="text/css">

body{

font-size:15px;

}

#txt{

height:400px;

width:600;

border:#333 solid 1px;

padding:5px;

}

p{

line-height:18px;

text-indent:2em;

}

</style>

<meta http-equiv="content-type" content="text/html; charset=UTF-8">

? ? ?</head>

??

? <body>

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

? ? <div id="txt">

? ? <h5 >JavaScript使網(wǎng)頁顯示動(dòng)態(tài)效果并實(shí)現(xiàn)與用戶交互功能。</h5>

? ? <p >1.

? ? javascript入門篇,讓不懂js的你,快速了解js。</p>

? ? <p>2.

? ? JavaScript進(jìn)階篇,讓你掌握js的基礎(chǔ)語法,函數(shù),數(shù)組,事件,內(nèi)置對(duì)象,bom瀏覽器

? ? dom操作</p>

? ? <p>3.

? ? 學(xué)完以上兩門基礎(chǔ)課程后,在深入學(xué)習(xí)javascript的變量作用域,事件,對(duì)象、運(yùn)動(dòng)、cookie、

? ? 正則表達(dá)式、ajax等課程</p>

? ? </div>

? ? <form >

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

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

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

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

? ? <input type="button" value="取消設(shè)置" onclick="cs()"/>

? ? ? </form>

? ? ? <script type="text/javascript">

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

? ? function changecolor(){

? ? ?mychar.style.color="red";

? ? }

? ? function changewh(){

? ? mychar.style.width="800px";

? ? mychar.style.height="200px";

? ? }

? ? function hidetxt(){

? ? ?mychar.style.display="none";

? ? }

? ??

? ? function showtxt(){

? ? ?mychar.style.display="block";

? ? }

? ? function cs(){

? ? var flag=confirm("取消設(shè)置?");

? ? if(flag==true){

? ? ? ?document.getElementById("txt").removeAttribute"style";

? ? ?}else{

? ? ??

? ? ?}

? ? }

? ? ?</script>

? ??

? </body>

</html>

這是我的代碼,想問下為什么我按每個(gè)按鈕都沒作用?

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

你把方法名改成小寫試試

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

那應(yīng)該是你的函數(shù)名字和onclick名字不對(duì)應(yīng)導(dǎo)致沒反應(yīng),仔細(xì)匹配對(duì)照一下,應(yīng)該就好了

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

加了,試過好多次,只有把這部分代碼刪了其他就起作用了。

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

xuanlovexbx

哦哦,那說明問題就出在你新加的改變寬高的函數(shù)了 function changeSize(){ var txt = document.getElementById("txt"); if(confirm("確認(rèn)修改寬高嗎?")){ txt.style.width = "300px"; txt.style.height = "300px"; } }你看看有木有什么區(qū)別?另外別忘調(diào)用,慢慢來,再試試吧,加油!
2017-08-29 回復(fù) 有任何疑惑可以回復(fù)我~

是不是數(shù)值后面忘記加px了,我有一次就是這個(gè)錯(cuò)誤,還有仔細(xì)檢查一下,代碼有木有字面錯(cuò)誤,正常都該好使的,就檢查你要加的改變寬高的函數(shù)。width="30px"...

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

舉報(bào)

0/150
提交
取消

點(diǎn)擊按鈕不起作用

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

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

幫助反饋 APP下載

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

公眾號(hào)

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