[转载]js javascript 判断字符串是否包含某字符串,String对象中查找子字符,indexOf var Cts = "bblText"; if(Cts.indexOf("Text") > 0 ) { alert('Cts中包含Text字符串'); }