在input后面的腳本里的語句document.write("我知道”)怎么不顯示出結果來
<!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("你javascript考的怎樣了?");? ? ? ? ? ? ??
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="點擊我,對成績做評價!" />
<script>??
? ? document.write("我知道“);
</script>
</body>
</html>
2019-09-28
上面的代碼覆蓋了下面的
2019-11-27
這個代碼可以實現你說的代碼。
<!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("要努力了!");
}
document.write("我知道了!");
? }
?
? </script>
</head>
<body>
? ? <input name="button" type="button" onClick="rec()" value="點擊我,對成績做評價!" />
</body>
</html>
2019-11-05
首先注意一下你的書寫,還有就是當你點擊button之后執行的代碼是? function rec(),你的document.write("我知道“);應該放在? function rec()就可以運行出來
2019-09-29
我知道后邊那個引號你打成中文的了
2019-09-28
我知道后面引號是中文引號
2019-09-28
我知道了,是用錯了一個雙引號,中文輸入法。。。。
2019-09-27
我也不知道怎么說呢,如果你用var去賦值再輸出的話,會顯示出來,然后在換上你的直接輸出我知道就行了,直接給它輸出不行....我也不知道為啥子