I want to change the style tag after generating contents. How can I add style to the style tag? I tried using:
document.getElementById(\'style\').appendChil
I tossed together a quick example at http://jsfiddle.net/fttS5/1/ .
You can attach an id to the style tags just like you would any other element in HTML.
Now you can take the code you tried with appendChild and add one quick change to it
document.getElementById('style').appendChild(document.createTextNode(styleContents));
This should do the trick. Good Luck.
You can also just use the innerHTML method listed as the answer below mine.