var a =10;
//型式一 : if
document.write("<br>型式一 : if<br>");
if(a>50){
document.write("a>50,a變數為:"+a);
}
if(a<50){
document.write("a<50,a變數為:"+a);
}
document.write("<br>");
//型式二 if -- else
document.write("<br>型式二 if -- else<br>");
if(a>50){
document.write("a>50,a變數為:"+a);
}else{
document.write("a<50,a變數為:"+a);
}
document.write("<br>");
//型式三 if -- else if
document.write("<br>型式三: if -- else if<br>");
if(a>50){
document.write("a>50,a變數為:"+a);
}else if(a<50){
document.write("a<50,a變數為:"+a);
}
結果:
- 首頁
- JAVA 目錄
- JAVA WEB 目錄
- JAVA 其他未分類 目錄
- Grails目錄
- jQuery 目錄
- Apache 目錄
- JavaScript 目錄
- Spring + Hibernate 目錄
- Hibernate 目錄
- Linux 目錄
- 程式開發工具目錄
- MySQL 目錄
- PHP目錄
- C/C++ 目錄
- Google App Engine 目錄
- HTML5/CSS3
- 程式開發基本資訊
- Android
- Oracle 目錄
- Struts 目錄