如果我要在判斷語句的條件里同時滿足兩個條件才執行,要如何寫
<!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?scre;?//score變量,用來存儲用戶輸入的成績值。 ????scre?=prompt("請輸入你的成績","請輸入0~100的數字")?; ???? ???? if(scre>=90+scre=<100) { ???document.write("你很棒!"); } else?if(scre>=75) ????{ ???document.write("不錯吆!"); } else?if(scre>=60) ????{ ???document.write("要加油!"); ????} ????else?if(scre>=0) { ???????document.write("要努力了!"); } else{ ????document.write("請輸入正確數值"); } ??} ??</script> </head> <body> ????<input?name="button"?type="button"?onClick="rec()"?value="點擊我,對成績做評價!"?/> </body> </html>
例如該代碼里,第一個if,要使數值大于等于90且小于等于100才執行,要怎么寫
2017-06-13
if(scre>=90+scre=<100) 改成?if(scre>=90 and scre=<100)或if(scre>=90 && scre=<100)
2017-06-27
if(scre>=90 && scre<=100),,輸入111,卻顯示“不錯喲”,與題目不符,請問原因?以及如何解決
2017-06-13
if(scre>=90+scre=<100) 改成if(scre>=90 && scre<=100),注意是<=。