為什么無法彈出對(duì)話框
<!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("請輸入你的成績:");
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>
2016-11-21
如圖,函數(shù)括號(hào)要對(duì)應(yīng)上,而你的函數(shù)少些了“}”
2016-11-09
onclick是小寫
2016-11-09
prompt后面要有兩個(gè)參數(shù),一個(gè)是顯示的文字,一個(gè)是輸入的變量,你那個(gè)缺了后面的變量