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

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

為什么我輸入的代碼運行不了

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

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

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

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

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

? </form>

? <script type="text/javascript">

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

{

? ? function changeColor(){

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

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

? ? }

? ? function changeSize(){

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

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

? ? }

? ? function hidetext(){

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

? ? }

? ? function showtext(){

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

? ? }

? ? function offset(){

? ? var mychar=confirm("確定要重置所有設置嗎?");

? ? if(mychar==true){

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

? ? }

? ??

? ? }

}


正在回答

1 回答

{
????function?changeColor(){
???????txt.style.color="red";?
???????txt.style.backgroundColor="#ccc";
????}
????function?changeSize(){
????????txt.style.width="500px";
????????txt.style.height="700px";
????}
????function?hidetext(){
????????txt.style.display="none";
????}
????function?showtext(){
????????txt.style.display="block";
????}
????function?offset(){
????var?mychar=confirm("確定要重置所有設置嗎?");
????if(mychar==true){
????????txt.removeAttribute('style');
????}
????
????}
}

這些函數外面包含的{}是怎么回事???

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

舉報

0/150
提交
取消

為什么我輸入的代碼運行不了

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

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

幫助反饋 APP下載

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

公眾號

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