tags:

views:

97

answers:

1

I am trying to use document.write(html); in my script but it looks illegal. I would like to write some html at the end of my document in a GM script. How do i do this?

+1  A: 

Simplest would be:

document.body.innerHTML += 'some html';

More robust and complex is to use DOM methods:

var myDiv = document.createElement('div');
myDiv.innerHTML = 'some text'; // yes, yes I am cheating here again but
                               // what did you expect from a short example?

document.body.appendChild(myDiv);

See the Gecko_DOM_Reference for more info about the DOM API.

slebetman