gsub(regexp, replacement [, target]) Search target for all of the longest, leftmost, nonoverlapping matching substrings it can find and replace them with replacement. The 'g' in gsub() stands for "global," which means replace everywhere. For exa…
JS字符串替换函数:Replace(“字符串1″, “字符串2″), 1.我们都知道JS中字符串替换函数是Replace(“字符串1″, “字符串2″),但是这个函数只能将第一次出现的字符串1替换掉,那么我们如何才能一次性全部替换掉了? <script> var s = "LOVE LIFE ! LOVE JAVA ..."; alert(s); alert(s.replace("LOVE ", "爱")); alert(s.repl…