var a='abc\\cba\\'; var b='\\\\'; alert(a.replace(/\\/g,b)); 转载于:https://www.cnblogs.com/baixc/p/4620613.html