indexOf()  函数"Hello world".indexOf("e") 
 返回 1  
// 从0 开始

解决方案 »

  1.   

    var s = "a.bmp";
    var re = /.bmp/i;
    if (re.test(s))
    {
      alert("found");
    }
      

  2.   

    var s="Hello world"
    s.search("e")
      

  3.   

    function IndexDemo(str2)
    {
      var str1 = "BABEBIBOBUBABEBIBOBU"
      var s = str1.indexOf(str2);
      return(s);
    }
    function SearchDemo()
    {
      var r, re;
      var s = "The quick brown fox jumped over the lazy yellow dog.";
      re = /fox/i;
      r = s.search(re);
      return(r);
    }