亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

為啥沒反應

為啥點擊了沒反應啊


?<input type="button" value="改變顏色" onClick="changeColor()"> ?

? ? <input type="button" value="改變寬高" onClick="changeWidth()">

? ? <input type="button" value="隱藏內容" onClick="displayNone()">

? ? <input type="button" value="顯示內容" onClick="displayBlock()">

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

? </form>

? <script type="text/javascript">

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

//定義"改變顏色"的函數

? ? function changeColor{

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

? ? ? ? txt.style.backgroundColor="#CCC";

? ? }


//定義"改變寬高"的函數

? ? function changeWidth(){

? ? ? ? txt.style.width="200px";

? ? ? ? txt.style.height="300px";

? ? }


//定義"隱藏內容"的函數

? ? function displayNone(){

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

? ? }


//定義"顯示內容"的函數

? ? function displayBlock(){

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

? ? }


//定義"取消設置"的函數

? ? function setConfirm(){

? ? ? ? var meg=confirm("重置?");

? ? ? ? if(meg){

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

? ? ? ? }

? ? }


正在回答

2 回答

function changeColor后加上小括號應該可以了

0 回復 有任何疑惑可以回復我~
#1

慕碼人2853246 提問者

謝謝了,我真是太粗心了
2017-07-14 回復 有任何疑惑可以回復我~

?function changeColor{ 方法名少了個小括號 ?可以用DW運行試試

1 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
JavaScript入門篇
  • 參與學習       741186    人
  • 解答問題       9866    個

JavaScript做為一名Web工程師的必備技術,本教程讓您快速入門

進入課程

為啥沒反應

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號