GreaseMonkey Document.Write or post HTMl at end?
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 thi开发者_StackOverflow社区s?
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.
精彩评论