Javascript Problem

aringail

Weaksauce
Joined
May 9, 2005
Messages
65
I am working on a javascript script that creates a table inside of a div and populates it with data

Code:
function MyClass(id_val,name_val,type_val){

	this.nodeTable = document.createElement('table');
	this.nodeDiv = document.createElement('div');
	this.nodeDiv.id = type_val + '-' + this.id;
	this.nodeDiv.display = 'none';
	
	this.nodeTable.cellpadding='2';
	this.nodeTable.border='1';
	this.nodeTable.width='100%';
	this.nodeTable.height='100%';
	
	var rowOne = document.createElement('tr');
	var rowTwo = document.createElement('tr');
	
	var cellOne   = document.createElement('td');
	var cellTwo   = document.createElement('td');
	var cellThree = document.createElement('td');
	var cellFour  = document.createElement('td');
	cellOne.width = '10';
	
	this.nameSpan = document.createElement('span');
	this.nameSpan.innerHTML=this.name;
	
	this.tableLink = document.createElement('a');
	this.tableLink.innerHTML='+';
	this.tableLink.src = '#';
	
	cellOne.appendChild(this.tableLink);
	cellOne.appendChild(this.nameSpan);
	
	cellFour.appendChild(this.nodeDiv);
	
	
	rowOne.appendChild(cellOne);
	rowOne.appendChild(cellTwo);
	
	rowTwo.appendChild(cellThree);
	rowTwo.appendChild(cellFour);


	this.nodeTable.appendChild(rowOne);
	this.nodeTable.appendChild(rowTwo);
}

theObj = new MyClass(nodeID,'test',this.type);
bodyDiv.appendChild(theObj.nodeTable);

Now, I don't get any code errors and if I do a alert(bodyDiv.innerHTML); after the code runs all the generated HTML looks fine. Except the page is blank. Nothing Shows up.

Somewhere something isn't properly visible.

Any ideas?

-Steve
 
Apparently I need to include a TBODY element inside of the table element. Stupid HTML :)
worked fine in NS8
 
Back
Top