27th
07.08
Javascript脚本:Switch语句
switch语句用于从多种选择路线中选择一条路线执行的情况。
与Vbscript中的select…case语句非常相似
swithc语句的语法格式:
- switch (expressin){
- case labe1 :
- statements;//条件表达式
- breadk;
- case labe2 :
- statements;
- breadk;
- }
写个代码示例:
- var color = promt("选择你喜欢的色彩-红,蓝,黄","");
- switch (color){
- case "红"
- document.wirte("红");
- break;
- ...........
- }
还有种情况如果有个条件case “expression”满足的话可写成
Read the rest of this entry »
Name: Cngothic 













