為什么無法彈出對話框
<!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變量,用來存儲用戶輸入的成績值。
score =prompt("請輸入你的成績:");
if(score>=90)
{
? document.write("你很棒!");
}
else if(score>=75)
? ? {
? document.write("不錯吆!");
}
else if(score>=60)
? ? {
? document.write("要加油!");
? ? }
? ? else
{
? ? ? ?document.write("要努力了!");
}
? </script>
</head>
<body>
? ? <input name="button" type="button" onClick="rec()" value="點擊我,對成績做評價!" />
</body>
</html>
2016-11-21
如圖,函數(shù)括號要對應(yīng)上,而你的函數(shù)少些了“}”
2016-11-09
onclick是小寫
2016-11-09
prompt后面要有兩個參數(shù),一個是顯示的文字,一個是輸入的變量,你那個缺了后面的變量