[Greasemonkey] Grab text string in TD

Aaron Boodman zboogs at gmail.com
Fri Apr 22 09:15:19 EDT 2005


document.body.innerHTML

or possibly even document.firstChild.innerHTML.

On 4/22/05, Scott R. Turner <srt at aero.org> wrote:
> 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
> 
> _______________________________________________
> Greasemonkey mailing list
> Greasemonkey at mozdev.org
> http://mozdev.org/mailman/listinfo/greasemonkey
>


More information about the Greasemonkey mailing list