[Greasemonkey] Grab text string in TD

Scott R. Turner srt at aero.org
Fri Apr 22 11:51:23 EDT 2005


On Fri, 22 Apr 2005, Jeremy Dunck wrote:
> On 4/22/05, Scott R. Turner <srt at aero.org> wrote:
>>      GM_find_and_replace(regexp, replace)
>
> var html = document.innerHTML;
> html.replace(regexp, replace);
> document.innerHTML = html;
>
> No?

I don't think this works.  Well, this as it stands doesn't work ("html
has no properties"), but a script like this:

    var html = document.innerHTML;
    document.innerHTML = "Empty Page!";

doesn't seem to do anything.  Maybe a mistake I'm making?  Or is there
a problem with trying to replace innerHTML?

But yes, something along those lines is what I'm thinking of, packaged
up to make it as accessible as possible to the casual script writer.

As to your other question, I was thinking of two different functions,
one which operated on the "plain text" (all HTML and scripts, etc.,
stripped out) and one which operated on the raw HTML, but maybe the
latter is all that is really useful.

  	  -- Scott



More information about the Greasemonkey mailing list