Hi,
here is an example of what is happening with fire fox and what process I am trying to accomplish.
EXAMPLE (http://www.geocities.com/ubhiceist/index3.html)
Notice that in IE after creating a box and changing its color the CSS source box below reflects the changes correctly vs FF whos changes are not caught and seem to be cached.
var makeCssTextNode = document.createTextNode("#" + elementIds + "{" + "\n" + " " + elementStyles + "\n" + "}" + "\n\n");
var getCssBox = document.getElementById("mainCSSBox");
getCssBox.appendChild(makeCssTextNode);
Contrary to the HTML appearance, a textarea element has no childNodes, thus you can not append a textNode. A textarea has a value attribute which controls its text, same as a textbox.
var makeCssText = "#" + elementIds + "{" + "\n" + " " + elementStyles + "\n" + "}" + "\n\n";
var getCssBox = document.getElementById("mainCSSBox");
getCssBox.value=makeCssText;
wow very interesting.
thanks again kor, learning new things each day!
In fact, well, stricto sensum, textarea has a textNode, but, excepting the case when it is initially and physically HTML written as a textNode, textarea supposes to show its value. The value attribute is the only one which matters for a form's control.:
http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-textContent
http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-24874179
That means FF is right and IE is wrong, as far as I can see :)
no surprise that its leaning on IE again :)
One more question kor and I swear I will leave ya alone :D
after cutting out the textNode I have a slight problem..
see example again:
EXAMPLE
If I now have more than one element into the mix the script fails to display all elements styles in the css box. It only locates the last node. these corners I keep painting my self into are very frustrating.
Ha see I am learning lol this was a simple fix.
var makeCssText = "#" + elementIds + "{" + "\n" + " " + elementStyles + "\n" + "}" + "\n\n";
var getCssBox = document.getElementById("mainCSSBox");
getCssBox.value= getCssBox.value+makeCssText;
each time it loops for a new element, it re-assigns the former value of the textarea to the current value of the text area until the over all string is complete.
AWESOME!