js中“/”不需要转义。 if(myPath.indexOf("/Upload/EmailFile/")!=-1){ alert("有附件!")} 转载于:https://www.cnblogs.com/Tpf386/p/6282773.html