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

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

帶一個參數(shù)的函數(shù)

帶一個參數(shù)的函數(shù)

qq_慕標(biāo)6304929 2020-03-28 15:57:37
請在預(yù)置代碼中編寫Javascript代碼,使預(yù)覽頁面實現(xiàn)如下效果:點擊Morning按鈕,引用id為demo的段落內(nèi)容顯示Good?Morning!; 點擊Evening按鈕,引用id為demo的段落內(nèi)容顯示Good?Evening!;任務(wù)與要求請定義函數(shù)myFunction,傳入一個參數(shù)text,使id為demo的段落返回text的值請在form標(biāo)簽內(nèi)創(chuàng)建一個按鈕,值為Morning,調(diào)用函數(shù)myFunction,點擊按鈕,段落內(nèi)容顯示Good Morning!請在form標(biāo)簽內(nèi)創(chuàng)建一個按鈕,值為Evening,調(diào)用函數(shù)myFunction,點擊按鈕,段落內(nèi)容顯示Good Evening!<!DOCTYPE html><html>?<head>?</head>?<body><form>?</form>?<p id="demo"></p></body>?</html>
查看完整描述

2 回答

已采納
?
蓮_蓶濏__

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

<!DOCTYPE?html>
<html>
<head>
<meta?charset="utf-8"?/>
<title></title>
</head>
<body>
<form>
<button?onclick="myFunction('Morning')"??type="button">Morning</button>
<button?onclick="myFunction('Evening')"??type="button">Evening</button>
</form>
<p?id="demo"></p>
<script>
function?myFunction(text)?{
document.getElementById('demo').innerHTML?=?'Good?'?+?text?+?'!';
}
</script>
</body>
</html>


查看完整回答
1 反對 回復(fù) 2020-03-30
?
蓮_蓶濏__

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

<!DOCTYPE?html>
<html>
<head>
<meta?charset="utf-8"?/>
<title></title>
</head>
<body>
<form></form>
<div?id="demo"></div>
<script>
function?myFunction(text)?{
document.getElementById('demo').textContent?=?'Good?'?+?text?+?'!;';
}
var?oBtnMor?=?document.createElement('input');
oBtnMor.type?=?"button";
oBtnMor.onclick?=?function()?{
myFunction('Morning');
};
oBtnMor.value?=?'Morning';
document.forms[0].appendChild(oBtnMor);
var?oBtnEve?=?document.createElement('input');
oBtnEve.type?=?"button";
oBtnEve.onclick?=?function()?{
myFunction('Evening');
};
oBtnEve.value?=?'Evening';
document.forms[0].appendChild(oBtnEve);
</script>
</body>
</html>


查看完整回答
反對 回復(fù) 2020-03-28
  • qq_慕標(biāo)6304929
    qq_慕標(biāo)6304929
    按鈕有點復(fù)雜,<button onclick="myFunction()"></button>這個不可以嗎
  • qq_慕標(biāo)6304929
    qq_慕標(biāo)6304929
    這段代碼請你幫忙看看,有點問題 <!DOCTYPE html> <html> <head> </head> <body> <form> <button onclick="myFunction()">Morning</button> <button onclick="myFunction()">Evening</button> </form> <p id="demo"></p> <script> function myFunction(text) { document.getElementById('demo').innerHTML = 'Good ' + text + '!'; } </script> </body> </html>
  • 蓮_蓶濏__
    蓮_蓶濏__
    可以啊 只是他說創(chuàng)建我以為是以DOM方式創(chuàng)建
  • 2 回答
  • 0 關(guān)注
  • 1121 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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