最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

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

我想實現(xiàn)點擊一下字體變一種顏色,再點擊變回原來的顏色。請問哪里錯了,謝謝。

<script language="javascript">

?/*var myarr = new Array(3);

?myarr[0]=88;

?myarr[1]=90;

?myarr[2]=68;*/

?

?myarr = [88,90,68];

?

? ? function aa(){

? ? ? ?if( document.getELementById("input").style.backgroundColor="red"){

? ? ? ? ? ?document.getELementById("input").style.backgroundColor="blue"

? ? ? ?}

? ? ? ?else{

? ? ? ? ? ?document.getELementById("input").style.backgroundColor="red"

? ? ? ?}

? ? }


? document.write("數(shù)組第一個值是:"+myarr[1]+"<br>");

? document.write("數(shù)組第二個值是:"+myarr[2]+"<br>");

? document.write("數(shù)組第三個值是:"+myarr[0]+"<br>");

</script>

</head>

<body>

? ? <input name="button" value="點擊變色" onclick="aa()"/>

</body>

</html>


正在回答

3 回答

document.getELementById("input")

?<input name="button" value="點擊變色" onclick="aa()"/>根本沒有設(shè)置ID名

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

qq_哦哦_10 提問者

非常感謝!
2017-02-15 回復(fù) 有任何疑惑可以回復(fù)我~

親,先把id弄清楚吧

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

<!DOCTYPE HTML>

<html>

<head>

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

<title> 卸載事件 </title>

<script language="javascript">

?/*var myarr = new Array(3);

?myarr[0]=88;

?myarr[1]=90;

?myarr[2]=68;*/

?

?myarr = [88,90,68];

?

? ? function aa(){

? ? ? ?if( document.getElementById("ipt").style.backgroundColor=="red"){

? ? ? ? ? ?document.getElementById("ipt").style.backgroundColor="blue"

? ? ? ?}

? ? ? ?else{

? ? ? ? ? ?document.getElementById("ipt").style.backgroundColor="red"

? ? ? ?}

? ? }


? document.write("數(shù)組第一個值是:"+myarr[1]+"<br>");

? document.write("數(shù)組第二個值是:"+myarr[2]+"<br>");

? document.write("數(shù)組第三個值是:"+myarr[0]+"<br>");

</script>

</head>

<body>

? ? <input type="button" value="點擊變色" onclick="aa()" id='ipt'/>

</body>

</html>

if判斷用“==”,用“=”是賦值了

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

風(fēng)之思語

getElementById l是小寫
2017-02-15 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消
JavaScript進(jìn)階篇
  • 參與學(xué)習(xí)       469020    人
  • 解答問題       22582    個

本課程從如何插入JS代碼開始,帶您進(jìn)入網(wǎng)頁動態(tài)交互世界

進(jìn)入課程

我想實現(xiàn)點擊一下字體變一種顏色,再點擊變回原來的顏色。請問哪里錯了,謝謝。

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

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

幫助反饋 APP下載

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

公眾號

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