Javascript code that is added at the end of a page, that checks the HTML code of that page, and it is checked against a list of words or phrases (also coded into the JS). When the text is found, the first occurrence is replaced with code that is paired with the keyword phrase. It must be possible to ignore text within certain tags (like header tags <h1>, <h2>, <a>, etc.).
example:
Keyword phrase, code replacement
customer service,<a href="alink">customer service</a>
Then the first occurrence of customer service would be replaced with the code, but it would be ignored if it's inside a <h1> tag for instance.
This is similar to the functionality of InfoLinks . com where ads are added to the page based on their ads, but in this case the word/phrase and code pairs are included in the javascript. Please keep it as simple as possible. **All other code in the page must remain unchanged.**
## Deliverables
The javascript should include:
* Code to list keyword phrase/replacement code pairs (like in an array). Please feed it with a few examples.
* Code to parse the BODY of the HTML page the javascript code was added to.
* When one of the keyword phrases is found, it is replaced with the replacement code, EXCEPT IF:
* the keyword is part of a tag
* the keyword is within these tags: <A>,<H1>,<H2>,<H3>,<H4>,<H5>,<H6>,<TH>,<SCRIPT>,<NOSCRIPT>,<SELECT>,<INPUT>,<PARAM>,<TITLE>,<OBJECT>,<EMBED>,<IFRAME>,<TEXTAREA>,<DT>,<DL>,<DD>,<FIELDSET>,<LEGEND>,<ACRONYM>,<ADDRESS>,<LABEL>,<STYLE>
* the keyword phrase was already changed once in the page.
* Appropriate commentary for documentation.
* Please provide the correct script code to add it to a HTML page.
* **Keep it as simple as possible.**
The code will be tested on a variety of HTML pages.
Thank you.