[Javascript] Not being displayed in IE

Julien Royer eldebaran at gmail.com
Fri Dec 15 02:38:39 CST 2006


Hi Peter,

You should maybe try to append the created rows to the tbody instead.

Julien

On 12/15/06, Peter Lauri <lists at dwsasia.com> wrote:
> Hi group,
>
> I have gotten a weird thing going on. I have confirmed that the below code
> works well in Firefox and Opera. However, in IE there is something strange
> going on.
>
> As you see in the code there are <tr> being created and put into a table. I
> have confirmed that all the <tr> are being inserted into the table in IE by
> counting and traversing the DOM for the table. However, the table does not
> change as it should :(
>
> Is there something special that needs to be done when doing this kind of
> thing in IE? Note that sc is a multidimensional array.
>
> Best regards,
> Peter Lauri
>
> function populateCartGraphic(sc) {
>         summarytable = document.getElementById("summary_table");
>
>         while(summarytable.childNodes.length >= 1) {
>                 summarytable.removeChild(summarytable.firstChild);
>         }
>
>         total = 0;
>
>         for(i=0; i<sc.length; i++) {
>                 newrow = document.createElement('tr');
>                 temp1 = document.createElement('td');
>                 temp1.innerHTML = sc[i][1] + ", " + sc[i][2];
>                 newrow.appendChild(temp1);
>
>
>                 temp1 = document.createElement('td');
>                 temp1.innerHTML = "&pound;" + sc[i][3];
>                 newrow.appendChild(temp1);
>
>                 temp1 = document.createElement('td');
>                 temp1.innerHTML = sc[i][4];
>                 newrow.appendChild(temp1);
>
>                 linetotal = sc[i][3]*sc[i][4];
>
>                 temp1 = document.createElement('td');
>                 temp1.innerHTML = "&pound;" + linetotal;
>                 newrow.appendChild(temp1);
>
>                 summarytable.appendChild(newrow);
>
>                 total += linetotal;
>
>         }
>
>
>         newrow = document.createElement('tr');
>         temp1 = document.createElement('td');
>         temp1.innerHTML = " ";
>         newrow.appendChild(temp1);
>
>
>         temp1 = document.createElement('td');
>         temp1.innerHTML = " ";
>         newrow.appendChild(temp1);
>
>         temp1 = document.createElement('td');
>         temp1.innerHTML = " ";
>         newrow.appendChild(temp1);
>
>         temp1 = document.createElement('td');
>         temp1.innerHTML = "&pound;" + total;
>         newrow.appendChild(temp1);
>
>         summarytable.appendChild(newrow);
>
> }



More information about the Javascript mailing list