課程
/前端開發(fā)
/JavaScript
/JavaScript入門篇
按了按鈕沒有任何反應(yīng),哪里出問題了?
2016-05-09
源自:JavaScript入門篇 4-1
正在回答
你綁定onclick="函數(shù)"事件沒有?
? var set={
changeColor:function(){
? ? txt.style.color="red";
? ? txt.style.backgroundColor="#ccc";
},
//定義"改變寬高"的函數(shù)
changeSize:function(){
? ? txt.style.width="300px";
? ? txt.style.height="300px";
//定義"隱藏內(nèi)容"的函數(shù)
Hide:function(){
? ? txt.style.display="none";
//定義"顯示內(nèi)容"的函數(shù)
Show:function(){
? ? txt.style.display="block";
//定義"取消設(shè)置"的函數(shù)
reset:function(){
var message=confirm("你確定要重置所有設(shè)置么?");
?if(message==true){
?txt.removeAttribute('style');
? ?}
? }
}
每個函數(shù)要用逗號分開
Hide:function:()你這兒也多了一個:
舉報
JavaScript做為一名Web工程師的必備技術(shù),本教程讓您快速入門
3 回答任何按鈕都沒有反應(yīng)
1 回答點擊五個按鈕沒有任何反應(yīng)
1 回答不知道哪里出問題了,按按鈕沒有任何反應(yīng)
3 回答為什么點擊按鈕沒有任何反應(yīng)
1 回答為什么點擊按鈕沒有任何反應(yīng)?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2016-05-09
你綁定onclick="函數(shù)"事件沒有?
2016-05-09
? var set={
changeColor:function(){
? ? txt.style.color="red";
? ? txt.style.backgroundColor="#ccc";
},
//定義"改變寬高"的函數(shù)
changeSize:function(){
? ? txt.style.width="300px";
? ? txt.style.height="300px";
},
//定義"隱藏內(nèi)容"的函數(shù)
Hide:function(){
? ? txt.style.display="none";
},
//定義"顯示內(nèi)容"的函數(shù)
Show:function(){
? ? txt.style.display="block";
},
//定義"取消設(shè)置"的函數(shù)
reset:function(){
var message=confirm("你確定要重置所有設(shè)置么?");
?if(message==true){
?txt.removeAttribute('style');
? ?}
? }
}
每個函數(shù)要用逗號分開
Hide:function:()你這兒也多了一個: