no*************@gmail.com wrote :
I don't know the problem with IE6. I have tried three methods, and
they all failed. I eliminated the use of mootools' framework in method
3. MooTools is not the problem. Because the table is created but is
not showing up. I have checked that with IE developper toolbar.
First problem: you have posted code and you have not posted an URL where
we can examine all of the page code. Do not post code; post an URL.
>
1st method
for(var i = 0; i < thelines.length; i++)
How do you create, how have you created the "thelines"? We can not read
that.
{
var newrow = new Element('tr');
What's the Element object? We can not see that.
I disagree and do not recommend creating your own functions when DOM 1
and DOM 2 functions have been already defined, created for such
purposes: why not use createElement() when it has been defined already
and when it should work in all DOM compliant browsers?
for(var j = 0; j < (posArray.length - 1); j++){
var newcol = new Element('td').appendText(result[i][j]);
newcol.injectInside(newrow);
Where is the injectInside function? We can not examine that.
Same comment here too. Why not use the DOM standard appendChild()
function which has been defined, standardized for all DOM compliant
browsers?
}
newrow.injectInside($('result'));
}
2nd method
for(var i = 0; i < thelines.length; i++ )
{
var newrow = new Element('tr');
for(var j = 0; j < (posArray.length - 1); j++){
var newcol = new Element('td');
var txt = document.createTextNode(result[i][j]);
newcol.appendChild(txt);
newrow.appendChild(newcol);
}
$('result').appendChild(newrow);
}
3rd method
var oTable = document.createElement('table');
var oTbody = document.createElement("tbody");
If I recall correctly, MSIE 6+ requires the creation of a tbody (or
table section like thead or tfoot) to append table rows.
var oRow, oCell;
oTable.id = 'result';
for(var i = 0; i < thelines.length; i++ )
{
oRow = document.createElement('tr');
for(var j = 0; j < (posArray.length - 1); j++)
Please verify that you need to substract 1 to the posArray.length. We
can't do this ... without looking to the whole code. An url ...
{
oCell = document.createElement('td');
oCell.innerText = result[i][j];
oCell.textContent = result[i][j];
Right here, the code is not precise.
Try instead:
oCell.appendChild(document.createTextNode(result[i][j]));
oRow.appendChild(oCell);
}
oTable.appendChild(oRow);
Instead,
oTbody.appendChild(oRow);
}
Now, when the external for loop (for rows) is done, append the tbody to
the table:
oTable.appendChild(oTbody);
oTableContainer = document.getElementById('tablecontainer');
oTableContainer.appendChild(oTable);
Since you are going, it seems, to be refering to oTableContainer only
once, then you can merge the 2 above instructions into a single one with:
document.getElementById("tablecontainer").appendCh ild(oTable);
If the above suggestions do not work, then post an url and we'll look at
the whole code.
Gérard
--
Using Web Standards in your Web Pages (Updated Apr. 2007)
http://developer.mozilla.org/en/docs...your_Web_Pages