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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

爽心悅目的代碼,但是this.index == oBtn.length - 1 && (oDiv.style.cssText = "");什么意思?

爽心悅目的代碼,但是this.index == oBtn.length - 1 && (oDiv.style.cssText = "");什么意思?

AllySu 2017-10-21 01:22:46
<!DOCTYPE?html?PUBLIC?"-//W3C//DTD?XHTML?1.0?Transitional//EN"?"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html?xmlns="http://www.w3.org/1999/xhtml"> <head> <meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"?/> <title>控制div屬性</title> <style> #outer{width:500px;margin:0?auto;padding:0;text-align:center;} #div1{width:100px;height:100px;background:black;margin:10px?auto;display:block;} </style> <script> var?changeStyle?=?function?(elem,?attr,?value) { elem.style[attr]?=?value }; window.onload?=?function?() { var?oBtn?=?document.getElementsByTagName("input"); var?oDiv?=?document.getElementById("div1"); var?oAtt?=?["width","height","background","display","display"]; var?oVal?=?["200px","200px","red","none","block"]; for?(var?i?=?0;?i?<?oBtn.length;?i++) { oBtn[i].index?=?i; oBtn[i].onclick?=?function?() { this.index?==?oBtn.length?-?1?&&?(oDiv.style.cssText?=?""); changeStyle(oDiv,?oAtt[this.index],?oVal[this.index]) } } }; </script> </head> <body> <div?id="outer"> <input?type="button"?value="變寬"?/> <input?type="button"?value="變高"?/> <input?type="button"?value="變色"?/> <input?type="button"?value="隱藏"?/> <input?type="button"?value="重置"?/> <div?id="div1"></div> </div> </body> </html>代碼簡(jiǎn)潔高效,但是this.index == oBtn.length - 1 && (oDiv.style.cssText = "");不大懂什么意思
查看完整描述

2 回答

?
慕虎5376285

TA貢獻(xiàn)2條經(jīng)驗(yàn) 獲得超2個(gè)贊

從功能效果上看 是用&&的特性代替了if? 當(dāng)&&前面的==為真時(shí)則運(yùn)行&&后面的? 當(dāng)&&前面的==為假時(shí)則停止運(yùn)行

查看完整回答
1 反對(duì) 回復(fù) 2017-10-23
?
慕虎5376285

TA貢獻(xiàn)2條經(jīng)驗(yàn) 獲得超2個(gè)贊

從功能效果上看 是用&&的特性代替了if? 當(dāng)&&前面的==為真時(shí)則運(yùn)行&&后面的? 當(dāng)&&前面的==為假時(shí)則停止運(yùn)行

查看完整回答
1 反對(duì) 回復(fù) 2017-10-23
  • 2 回答
  • 0 關(guān)注
  • 2730 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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