J
Joseph Scoccimaro
Currently I am trying to use JavaScript within greasemonkey to dynamically
put a menu at the top of each page. I am running in to trouble when I try
to append a node representing a script tag to the header section. It ends
up not adding anything to the document. I am currently getting no errors
from the javascript panel in firefox. Here is the code I am using:
HeadTag = document.getElementsByTagName("head");
var scriptElement = document.createElement('script');
if (scriptElement) {
scriptElement.type = 'text/javascript';
scriptElement.id = 'addedscript';
HeadTag[0].appendChild(scriptElement);
}
Please let me know if I am doing something wrong or if i need to add more to
this code. Also, how do I then add the javascript code to the newly created
node? Thanks for the help.
Joseph Scoccimaro
(e-mail address removed)
put a menu at the top of each page. I am running in to trouble when I try
to append a node representing a script tag to the header section. It ends
up not adding anything to the document. I am currently getting no errors
from the javascript panel in firefox. Here is the code I am using:
HeadTag = document.getElementsByTagName("head");
var scriptElement = document.createElement('script');
if (scriptElement) {
scriptElement.type = 'text/javascript';
scriptElement.id = 'addedscript';
HeadTag[0].appendChild(scriptElement);
}
Please let me know if I am doing something wrong or if i need to add more to
this code. Also, how do I then add the javascript code to the newly created
node? Thanks for the help.
Joseph Scoccimaro
(e-mail address removed)