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

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么我所有按鈕都不起作用呢?

為什么我所有按鈕都不起作用呢?

慕先生9415357 2016-10-07 00:20:25
?<!--當點擊相應(yīng)按鈕,執(zhí)行相應(yīng)操作,為按鈕添加相應(yīng)事件-->? ? <input type="button" value="改變顏色" onclick="ys"> ?? ? <input type="button" value="改變寬高" onclick="kd">? ? <input type="button" value="隱藏內(nèi)容" onclick="yc">? ? <input type="button" value="顯示內(nèi)容" onclick="xs">? ? <input type="button" value="取消設(shè)置" onclick="qx">? </form>? <script type="text/javascript">? var txt=document.getElementById("txt");? var con=document.getElementById("con");? function ys()??? ? {txt.style.color="red";? ? con.style.backgroundColor="blue"}//定義"改變顏色"的函數(shù)}function kd(){txt.style.width="100px";txt.style.height="100px";? ??}//定義"改變寬高"的函數(shù)function yc(){? ? txt.style.display="none"}//定義"隱藏內(nèi)容"的函數(shù)function xs(){txt.style.display="block"? ??}//定義"顯示內(nèi)容"的函數(shù)function qx(){var message=confirm("你確認要重組所有設(shè)置嗎?")? if (txt=true)? ? txt.removeAttribute('style');}? ??}//定義"取消設(shè)置"的函數(shù)? </script></body></html>
查看完整描述

2 回答

已采納
?
stone310

TA貢獻361條經(jīng)驗 獲得超191個贊

3個問題?

1、是ys()和qx()都多了一個"}"

2、行間調(diào)用函數(shù),只要被調(diào)用的函數(shù)放在全局作用域中,放前面放后面都可以調(diào)用,你這里位置是沒錯的,但是行間調(diào)用寫錯了,這么寫:

?<input type="button" value="改變顏色" onclick="ys()">,帶上括號??

3、qx()函數(shù)里面,因為你定義message=confirm,所以if(message==true);按照你原來寫法相當于將txt這個變量重新賦值為true,下面的語句就無法執(zhí)行

查看完整回答
1 反對 回復 2016-10-07
  • 2 回答
  • 0 關(guān)注
  • 1334 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

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