I've been trying (rather unsuccessfully) to create a user script that
will add a menu item to a website. My javascript is a bit rusty, but
this is basically what I have:

var menuNode = document.getElementById("contentSwitch");
var nixTab = document.createElement("li");
var listNode = menuNode.childNodes;
nixTab.innerHTML="<div>somebitsofhtml<div>"
menuNode.insertBefore(nixTab, listNode[7]);

My problem lies with the menuNode variable. It keeps coming back null,
which leads me to believe that the code is executed before the element
it's trying to get exists. I've tried a few suggestions on the
internet to trigger the code once the element has loaded but none of
it seems to work...the menuNode variable is always null.

Any help would be awesome.

-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en.

Reply via email to