The following statements are not displayed
李涛
李涛 2019-01-22 22:21:53
0
2
1075
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>shiyan</title>
</head>
<body>
  <script>
     var box=1;
     switch(box){
          case 1:document.write("数字1")
          baeak;  
          case 2:document.write("数字2")
          baeak;   
          case 3:document.write("数字3")
          baeak;  
          default:document.write("以上数值都不匹配")
      }
          var str="how do you do";
          var v1=str.indexOf("do");
          document.write(v1+"<br>");//返回do字符串起始位置
          var v2=str.lastIndexOf("do");
          document.write(v2+"<br>");//返回do字符串 最后一个字符串的开始位置
  </script>
</body>
</html>

老师您好, 前面是一个switch语句,在浏览器打印出了数字1,但是后面测试字符串
起始位置的语句没有执行打印, 把switch语句注释后,可以正常执行打印出字符串
的位置,  这个是什么原因, 请指教!  谢谢!!!


李涛
李涛

reply all(1)
刘宁

break;Your switch is written incorrectly

  • reply Thanks!
    李涛 author 2019-01-23 16:52:51
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!