為啥文本框里會有默認(rèn)值??
<!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="點(diǎn)擊我,對成績做評價(jià)!" />
</body>
</html>
2017-04-21
prompt的第二個參數(shù)是可以修改的,值也可以預(yù)先給定