What I am trying to do it to skim through text received as a result of a javascript (and possible play around with it) before it is displayed on the page. I can't get my head around how it should be done.
well, i get an html (or any type of text for that matter) as a result from a javascript, what i want to do is scan that html page and look for specific keywords. The real issue is doing that prior to it being displayed on the page.
For example, to replace "orig" with "dest" only inside a "idKeywords" HTML tag, you can use something like this: <script type="text/javascript"> function f_InnerEnId( p_id, p_toInner ) { try { document.getElementById( p_id ).innerHTML = p_toInner; } catch(e) { } } function f_getElement(p_id) { l_text=""; try { l_elem=document.getElementById(p_id); try { l_text+=l_elem.innerHTML; } catch(e) { serializer1=new XMLSerializer(); l_text+=serializer1.serializeToString(l_elem); }; } catch(e) { } return l_text; } var l_oldData = f_getElemento( "idKeywords" ); var l_pattern = /(orig)/g; var l_newData = l_oldData.replace( l_pattern, 'dest' ); f_InnerEnId( "idKeywords", l_newData ); </script> Code (markup): And instead of "orig" and "dest" it will be better with your own regular expressions.