為什么不加else時(shí)可以顯示,加了else之后將變量值改為<60就不可以了呢
<!DOCTYPE?html?PUBLIC?"-//W3C//DTD?XHTML?1.0?Transitional//EN"?"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html?xmlns="http://www.w3.org/1999/xhtml"> <head> <meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"?/> <title>邏輯與</title> <script?type="text/javascript"> ?var?numa,numb; ?numa=80; ?numb=70; ?if(numa>=60&&numb>=60){ ??document.write("JavaScript考核通過!"+"<br>"); ??else?{document.write("未通過");} ? ??} </script> </head> <body> </body> </html>
2018-06-22
格式錯(cuò)了,具體參考 上面的回答
2018-03-20
你的if else的格式錯(cuò)了
2018-03-11
格式不對(else要拿到大括號外面來)
if(條件表達(dá)式){
分支一
}
else{
分支二
}
2018-03-10
?if(numa>=60&&numb>=60) {
? document.write("JavaScript考核通過!"+"<br>");
?}
? else {
? ? ? document.write("未通過");
? }