[Greasemonkey] document.createElement returns null
Fabien Bergeret
fabien.bergeret at laposte.net
Fri Jun 10 12:00:40 EDT 2005
I've already posted few days ago (was "inserting a script on a HTML page") : it didn't work 'coz the object I was setting the innerHTML attribute was null.
But why was it null ?
Here is a code sample :
function addDiv() {
var div = document.createElement("div");
GM_log("Div created "+div);
div.setAttribute('id','converter');
div.setAttribute('style','position: absolute; background-color: #FFFF00; visibility: hidden; padding:5px; border: 1px solid #000; color: #000; text-align: center;');
log("Div attribute set");
document.body.insertBefore(div, document.body.lastChild);
log("Div inserted");
}
The first line of the function creates a correct div on amazon.com for intance, but return a null value on ebay.com. Any idea why ?
Thanks !
Accédez au courrier électronique de La Poste : www.laposte.net ;
3615 LAPOSTENET (0,34/mn) ; tél : 08 92 68 13 50 (0,34/mn)
More information about the Greasemonkey
mailing list