I'm new to this and trying out a few projects to get started. What I want to do is get the script to search the page for keywords kept in one of three arrays and highlight the word in a colour depending on which array it is in. It's finding the words fine but instead of highlighting is just printing out the html to document;
First way I tried was;
s=s.replace(new RegExp(testArrayOne[j],'gi'),'<span style="color:#ff0000">' + testArrayOne[j] + '</span>');
I tried a second way using innerHTML which produced [object XPCNativeWrapper [object HTMLSpanElement]] instead of the html.
I should mention this is a userscript for greasemonkey and, as I say, I'm fairly new to this so I apologise if the answer is obvious.
Thanks for the help