can some one please write a script that replaces all "5" to "five" and "4" to "four" in a webpage? please note that replacing "4" and "5" are just examples I had a script before but I went on my site on internet explorer and it wasn't changing the words. It only worked in firefox. this is the script i had before:
(script from dive into gease monkey)Code:var replacements, regex, key, textnodes, node, s; replacements = { "\u201cv": "c", "\u201c": '"', "\u201d": '"', "\u2026": "...", "\u2002": " ", "\u2003": " ", "\u2009": " ", "\u2013": "-", "\u2014": "--", "\u2122": "(tm)"}; regex = {}; for (key in replacements) { regex[key] = new RegExp(key, 'g'); } textnodes = document.evaluate( "//text()", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for (var i = 0; i < textnodes.snapshotLength; i++) { node = textnodes.snapshotItem(i); s = node.data; for (key in replacements) { s = s.replace(regex[key], replacements[key]); } node.data = s; }



Reply With Quote


Bookmarks