sniperman
02-11-2011, 04:12 PM
I'm hoping someone can help the brain freeze I've had in the past couple of hours. I am using the below code to create a text node and a span element.
onload=function(){
var root = document.getElementById('zonediv');
for(var i=0;i<D.length;i++){
root.appendChild(document.createTextNode(D[i][0]+' '))
var sp= document.createElement('span');
sp.appendChild(document.createTextNode(' '));
root.appendChild(sp);root.appendChild(document.createElement('br'))
}
I can't really style a text element directly inside a DIV without some kind of mark-up so I am trying to make the DOM create nodes in this order
<div id="zonediv"> // parent
<p> // need to replace text node with p element
<span>
<br>
I know it's probably easy, my brain just won't register at this time of night... so thanks in advance.
onload=function(){
var root = document.getElementById('zonediv');
for(var i=0;i<D.length;i++){
root.appendChild(document.createTextNode(D[i][0]+' '))
var sp= document.createElement('span');
sp.appendChild(document.createTextNode(' '));
root.appendChild(sp);root.appendChild(document.createElement('br'))
}
I can't really style a text element directly inside a DIV without some kind of mark-up so I am trying to make the DOM create nodes in this order
<div id="zonediv"> // parent
<p> // need to replace text node with p element
<span>
<br>
I know it's probably easy, my brain just won't register at this time of night... so thanks in advance.