close


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);
}

結果:










 















其它文章


arrow
arrow
    創作者介紹
    創作者 PG Levin Li 的頭像
    PG Levin Li

    程式開發學習之路

    PG Levin Li 發表在 痞客邦 留言(0) 人氣()