标签:
<!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>switch 语句</title> <script type="text/javascript" > var hours = window.prompt("请输入一个0-24的时间点数字"); hours = parseInt(hours);//把字符串类型转为整型 switch( hours ) { case 12: case 13: case 14: case 15: case 16: case 17: case 18: document.write("<h3>下午好!欢迎来到贵美。</h3>"); break; case 19: case 20: case 21: case 22: case 23: case 24: document.write("<h3>晚上好!欢迎来到贵美。</h3>"); break; default: document.write("<h3>上午好!欢迎来到贵美。</h3>"); } </script> </head> <body> </body> </html>
标签:
原文地址:http://www.cnblogs.com/xiaotaoxu/p/5544551.html