Hello,
I've done some searching around the post, and I have found quite a bit of information related to the setAttribute and it's related uses. My problem lies in the usage of colspanning in dynamic table creation.
Code Snippet
[CODE=javascript]<SCRIPT LANGUAGE="JavaS cript">
function morecase(id){
var tbody = document.getEle mentById(id).ge tElementsByTagN ame("TBODY")[0];
var row1=document.c reateElement('T R');
var row1td1=documen t.createElement ('TD');
row1td1.appendC hild(document.c reateTextNode(' Incident: '));
var row1td2=documen t.createElement ('TD');
row1td2.appendC hild(document.c reateElement('I NPUT'));
row1td2.setAttr ibute('TYPE','t ext','NAME','in cident');
var row2=document.c reateElement('T R');
var row2td1=documen t.createElement ('TD');
row2td1.appendC hild(document.c reateTextNode(' Blah blah blah blah blah blah blah'));
row2td1.setAttr ibute('colspan' ,'2');
row1.appendChil d(row1td1);
row1.appendChil d(row1td2);
row2.appendChil d(row2td1);
tbody.appendChi ld(row1);
tbody.appendChi ld(row2);
}
</script>
[/CODE]
Everything works, but the COLSPAN does not process.
I can pass other commands to the TD (width, bgcolor, etc.) and they work fine, COLSPAN is just my headache.
Any help would be greatly appreciated!
William
POST NUMBER 1 Woo! :rolleyes:
I've done some searching around the post, and I have found quite a bit of information related to the setAttribute and it's related uses. My problem lies in the usage of colspanning in dynamic table creation.
Code Snippet
[CODE=javascript]<SCRIPT LANGUAGE="JavaS cript">
function morecase(id){
var tbody = document.getEle mentById(id).ge tElementsByTagN ame("TBODY")[0];
var row1=document.c reateElement('T R');
var row1td1=documen t.createElement ('TD');
row1td1.appendC hild(document.c reateTextNode(' Incident: '));
var row1td2=documen t.createElement ('TD');
row1td2.appendC hild(document.c reateElement('I NPUT'));
row1td2.setAttr ibute('TYPE','t ext','NAME','in cident');
var row2=document.c reateElement('T R');
var row2td1=documen t.createElement ('TD');
row2td1.appendC hild(document.c reateTextNode(' Blah blah blah blah blah blah blah'));
row2td1.setAttr ibute('colspan' ,'2');
row1.appendChil d(row1td1);
row1.appendChil d(row1td2);
row2.appendChil d(row2td1);
tbody.appendChi ld(row1);
tbody.appendChi ld(row2);
}
</script>
[/CODE]
Everything works, but the COLSPAN does not process.
I can pass other commands to the TD (width, bgcolor, etc.) and they work fine, COLSPAN is just my headache.
Any help would be greatly appreciated!
William
POST NUMBER 1 Woo! :rolleyes:
Comment