課程
/前端開發(fā)
/JavaScript
/JavaScript入門篇
這個(gè)用prompt應(yīng)該先跳出來輸入成績的,怎么寫的?
2017-03-28
源自:JavaScript入門篇 2-4
正在回答
score?=prompt("請(qǐng)輸入分?jǐn)?shù)","80");
80是提示輸入框自動(dòng)顯示的分?jǐn)?shù)
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>prompt</title>
? <script type="text/javascript">
? function rec(){
var score = prompt("請(qǐng)輸入你的成績");
if(score>=90)
{
? document.write("你很棒!");
}
else if(score>=75)
? ? {
? document.write("不錯(cuò)吆!");
else if(score>=60)
? document.write("要加油!");
? ? }
? ? else
? ? ? ?document.write("要努力了!");
? }
? </script>
</head>
<body>
? ? <input name="button" type="button" onClick="rec()" value="點(diǎn)擊我,對(duì)成績做評(píng)價(jià)!" />
</body>
</html>
試試我這個(gè)吧~
<!DOCTYPE?HTML> <html> <head> <meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"?/> <title>prompt</title> ??<script?type="text/javascript"> ??function?rec(){ ????var?score;?//score變量,用來存儲(chǔ)用戶輸入的成績值。 ????score?=prompt("請(qǐng)輸入你的成績","520!"); ????if(score>=90) ????{ ???????document.write("你很棒!"); ????} ????else?if(score>=75) ????{? ???????document.write("不錯(cuò)吆!"); ????} ????else?if(score>=60) ????{ ???????document.write("要加油!"); ????} ????else ????{ ???????document.write("要努力了!"); ????} ??} ??</script> </head> <body> ????<input?name="button"?type="button"?onClick="rec()"?value="點(diǎn)擊我,對(duì)成績做評(píng)價(jià)!"?/> </body> </html>
<!DOCTYPE?HTML> <html> <head> <meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"?/> <title>prompt</title> ??<script?type="text/javascript"> ??function?rec(){ var?score;?//score變量,用來存儲(chǔ)用戶輸入的成績值。 score?=prompt("請(qǐng)輸入分?jǐn)?shù)"); if(score>=90) { ???document.write("你很棒!"); } else?if(score>=75) ????{ ???document.write("不錯(cuò)吆!"); } else?if(score>=60) ????{ ???document.write("要加油!"); ????} ????else { ???????document.write("要努力了!"); } ??} ??</script> </head> <body> ????<input?name="button"?type="button"?onClick="rec()"?value="點(diǎn)擊我,對(duì)成績做評(píng)價(jià)!"?/> </body> </html>
白狼x 提問者
changings 回復(fù) 白狼x 提問者
舉報(bào)
JavaScript做為一名Web工程師的必備技術(shù),本教程讓您快速入門
3 回答這個(gè)代碼怎么寫
4 回答這個(gè)問題的代碼怎么寫呀
2 回答怎么寫script代碼?
2 回答怎么完善這個(gè)代碼?
3 回答這個(gè)代碼怎么錯(cuò)了
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2017-05-14
score?=prompt("請(qǐng)輸入分?jǐn)?shù)","80");
80是提示輸入框自動(dòng)顯示的分?jǐn)?shù)
2017-04-04
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>prompt</title>
? <script type="text/javascript">
? function rec(){
var score = prompt("請(qǐng)輸入你的成績");
if(score>=90)
{
? document.write("你很棒!");
}
else if(score>=75)
? ? {
? document.write("不錯(cuò)吆!");
}
else if(score>=60)
? ? {
? document.write("要加油!");
? ? }
? ? else
{
? ? ? ?document.write("要努力了!");
}
? }
? </script>
</head>
<body>
? ? <input name="button" type="button" onClick="rec()" value="點(diǎn)擊我,對(duì)成績做評(píng)價(jià)!" />
</body>
</html>
2017-03-30
試試我這個(gè)吧~
2017-03-28