Problem applying DIV Justify (JavaScript DOM)

webmasterbeta

New Member
I am having problem applying the DIV Justify on the line mentioned below. 'theLink' is formatted URL and the rest is normal text. So, I am getting 'Type Mismatch' error. But, I want to apply the <DIV align='Justify'> for the total. Any ideas please ?

function createTable()
{
var x = xmlDoc.getElementsByTagName('topic');
var newEl = document.createElement('TABLE');
var tmp = document.createElement('TBODY');
newEl.appendChild(tmp);
var row = document.createElement('TR');
var container = document.createElement('TD');
var pos = Math.floor(Math.random() * x.length);
var topicTitle = document.createTextNode(x[pos].childNodes[0].firstChild.nodeValue);
var topicUrl = document.createTextNode(x[pos].childNodes[1].firstChild.nodeValue);
var topicContent = document.createTextNode(x[pos].childNodes[2].firstChild.nodeValue);
var theDiv = document.createElement('DIV');
theDiv.setAttribute('align','justify');
var theLink = document.createElement('A');
theLink.setAttribute('href', topicUrl.data);
theLink.setAttribute('title', topicTitle.data);
theLink.appendChild(document.createTextNode(topicTitle.data));
var myHtml = document.createTextNode(': ');
theDiv.appendChild(theLink+document.createTextNode(': '+topicContent.data)); ---------- ERROR ON THIS LINE ---------
container.appendChild(theDiv);
row.appendChild(container);
tmp.appendChild(row);
document.getElementById('spotlight').appendChild(newEl);
}
</script>
 
Back
Top