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

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

求指點(diǎn)指點(diǎn),新手

求指點(diǎn)指點(diǎn),新手

AUSKEVIN1989 2015-09-14 10:48:15
我在JavaScript入門經(jīng)典(第五版),第13章 根據(jù)title選擇樣式表的例子如下:<!DOCTYPE html><html><head><title>Switch stylesheets with JavaScript</title><style title="sheet1">body{background-color:white;color:red;}</style><style title="sheet2">body{background-color:black;color:yellow;}</style><style title="sheet3">body{background-color:pink;color:green;}</style><script>function ssEnable(mySheet){var change=false;var oldSheet=0;for(var i=0;i<document.styleSheets.length;i++){if(document.styleSheets[i].disabled==false){oldSheet=i;}document.styleSheets[i].disabled=true;if(document.styleSheets[i].title==mySheet){document.styleSheets[i].disabled=false;change=true;}}if(!change)document.styleSheets[oldSheet].disabled=false;return change;}function sheet(){var sheetName = prompt("Stylesheet Name?");if(!ssEnable(sheetName)){alert("Not found - original stylesheet retained.");}}window.onload=function(){document.getElementById('btn1').onclick=sheet;}</script></head><body>Switch my Stylesheet with the button below!<br/><input type="button" id="btn1" value="Change Sheet"/></body></html>我發(fā)現(xiàn)了if(!change)document.styleSheets[oldSheet].disabled=false;return change;如果將代碼加上{}中,是會彈出提示框alert("Not found - original stylesheet retained.");但是按照書中寫是沒有,為什么呢?求各位指點(diǎn)指點(diǎn),謝謝如果把if(!change)document.styleSheets[oldSheet].disabled=false;return change;寫成:if(!change){document.styleSheets[oldSheet].disabled=false;return change;}就會彈框,而樣式也改變了
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 1174 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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