// 参数设置 var defKeyWord="信息 | 办手续 | 正孕育 | 重要 | 电子信息 | 进行 | 面向"; //输入要替换的字符,字符间用 “ | ”分隔var keyWordBegin = "<FONT size=2>"; //要替换内容的起始字符var keyWordEnd = "</FONT></DIV></SPAN> </td>"; //要替换内容的结束字符/**//****************************/var tagName = "body";var aLLContent = document.getElementsByTagName(tagName).item(0).innerHTML;var fileContent;var headContent = "";var endContent = "";var locationOfKeyWordBegin = aLLContent.indexOf(keyWordBegin);var locationOfKeyWordEnd = aLLContent.indexOf(keyWordEnd);if (locationOfKeyWordBegin == -1 && locationOfKeyWordEnd == -1 && keyWordEnd != "" && keyWordBegin != "") ...{ }else if (locationOfKeyWordBegin != -1 && locationOfKeyWordEnd != -1 && keyWordEnd != "") ...{ fileContent = aLLContent.substring(locationOfKeyWordBegin, locationOfKeyWordEnd + keyWordEnd.length); headContent = aLLContent.substring(0, locationOfKeyWordBegin); endContent = aLLContent.substring(locationOfKeyWordEnd + keyWordEnd.length); splitKeyWord(defKeyWord);}else if (keyWordEnd == "" || aLLContent.indexOf(keyWordBegin) != -1) ...{ fileContent = aLLContent.substring(locationOfKeyWordBegin); headContent = aLLContent.substring(0, locationOfKeyWordBegin); splitKeyWord(defKeyWord);}else if (keyWordBegin == "" && keyWordEnd == "") ...{ fileContent = aLLContent; splitKeyWord(defKeyWord);}function splitKeyWord() ...{ var defChar=defKeyWord.split(" | "); var keyWord; var links; var textFinished = new Array(); for (i = 0; i < defChar.length; i++) ...{ keyWord = defChar[i]; links = "<a href="html/jsoperators.asp?gjc=" + keyWord + "">" + keyWord + "</a>"; fileContent = executeReplace(keyWord, links); } document.getElementsByTagName(tagName).item(0).innerHTML = headContent + fileContent + endContent; return;}function executeReplace(keyWord, links) ...{ return(fileContent.replace(new RegExp(keyWord,"g"), links));}