KevinJohnson
11-16-2010, 05:28 PM
I'm almost finished with this app for XUL / HTML Table Generation, and i have a really strange problem...
The HTML strings in the Arrays can be changed, and the HTML file saved, and the HTML page reloaded, and the changes will render.
However, i have one array, no matter what i change the HTML strings to, it refuses to render the changes made to the HTML strings.
It's quite confusing...
the array in question is
// Humidor InnerHTML
HumidorInnerHTML[0] = "<img src='NoImage.gif' style='height:100px; width:100px;'>";
HumidorInnerHTML[1] = "<input type='textbox' id='Others_Caption" + HumidorIndex + "'>";
HumidorInnerHTML[2] = "<input type='textbox' value='85' id='Others_Height" + HumidorIndex +"'>";
HumidorInnerHTML[3] = "<input type='textbox' value='85' id='Others_Width" + HumidorIndex +"'>";
HumidorInnerHTML[4] = "<img src='NoImage.gif' style='height:100px; width:100px;'>";
HumidorInnerHTML[5] = "<img src='NoImage.gif' style='height:100px; width:100px;'>";
HumidorInnerHTML[6] = "<img src='delete.png' onClick=DeleteRow('" + HumidorIndex + "','Humidor_Table');>";
HumidorInnerHTML[7] = "<img src='add.png' onClick=AddRow('" + HumidorIndex + "','Humidor_Table');>";
and the function that generates the HTML Table on the fly (and adds the cell data to them) is here:
function AddRow(index, DIV)
{
MyTable = document.getElementById(DIV);
var newCell;
var newRow = MyTable.insertRow(index);
var Length;
switch (DIV)
{
case "Intro_Table" : Length = IntroInnerHTML.length;
break;
case "Image_Table" : Length = ImageInnerHTML.length;
break;
case "Watch_Table" : Length = WatchInnerHTML.length;
break;
case "Others_Table" : Length = OthersInnerHTML.length;
break;
case "Humidor_Table" : Length = HumidorInnerHTML.length;
break;
}
for (var i = 0; i < Length; i++)
{
newCell = newRow.insertCell(i);
switch (DIV)
{
case "Intro_Table": newCell.innerHTML = IntroInnerHTML[i];
break;
case "Image_Table": newCell.innerHTML = ImageInnerHTML[i];
break;
case "Watch_Table": newCell.innerHTML = WatchInnerHTML[i];
break;
case "Others_Table": newCell.innerHTML = OthersInnerHTML[i];
break;
case "Humidor_Table": newCell.innerHTML = WatchInnerHTML[i];
break;
}
}
// Update the Index Counters
switch (DIV)
{
case "Intro_Table": IntroIndex++;
break;
case "Image_Table": ImageIndex++;
break;
case "Watch_Table": WatchIndex++;
break;
case "Others_Table": OthersIndex++;
break;
case "Humidor_Table": HumidorIndex++;
break;
}
}
when the page is loaded, the Init() function is started, that code is here:
function Init()
{
AddRow(1, "Intro_Table");
AddRow(1, "Image_Table");
AddRow(1, "Watch_Table");
AddRow(1, "Humidor_Table");
AddRow(1, "Others_Table");
}
Did i miss something? there must be something i've over looking. I have even tried isolating some other external JS, and CSS includes that i have, and isolating them has no change in the result.
the html file is live here:
http://kevinjohnson.clanteam.com/XML-App/ManageSite.html
thanks :)
The HTML strings in the Arrays can be changed, and the HTML file saved, and the HTML page reloaded, and the changes will render.
However, i have one array, no matter what i change the HTML strings to, it refuses to render the changes made to the HTML strings.
It's quite confusing...
the array in question is
// Humidor InnerHTML
HumidorInnerHTML[0] = "<img src='NoImage.gif' style='height:100px; width:100px;'>";
HumidorInnerHTML[1] = "<input type='textbox' id='Others_Caption" + HumidorIndex + "'>";
HumidorInnerHTML[2] = "<input type='textbox' value='85' id='Others_Height" + HumidorIndex +"'>";
HumidorInnerHTML[3] = "<input type='textbox' value='85' id='Others_Width" + HumidorIndex +"'>";
HumidorInnerHTML[4] = "<img src='NoImage.gif' style='height:100px; width:100px;'>";
HumidorInnerHTML[5] = "<img src='NoImage.gif' style='height:100px; width:100px;'>";
HumidorInnerHTML[6] = "<img src='delete.png' onClick=DeleteRow('" + HumidorIndex + "','Humidor_Table');>";
HumidorInnerHTML[7] = "<img src='add.png' onClick=AddRow('" + HumidorIndex + "','Humidor_Table');>";
and the function that generates the HTML Table on the fly (and adds the cell data to them) is here:
function AddRow(index, DIV)
{
MyTable = document.getElementById(DIV);
var newCell;
var newRow = MyTable.insertRow(index);
var Length;
switch (DIV)
{
case "Intro_Table" : Length = IntroInnerHTML.length;
break;
case "Image_Table" : Length = ImageInnerHTML.length;
break;
case "Watch_Table" : Length = WatchInnerHTML.length;
break;
case "Others_Table" : Length = OthersInnerHTML.length;
break;
case "Humidor_Table" : Length = HumidorInnerHTML.length;
break;
}
for (var i = 0; i < Length; i++)
{
newCell = newRow.insertCell(i);
switch (DIV)
{
case "Intro_Table": newCell.innerHTML = IntroInnerHTML[i];
break;
case "Image_Table": newCell.innerHTML = ImageInnerHTML[i];
break;
case "Watch_Table": newCell.innerHTML = WatchInnerHTML[i];
break;
case "Others_Table": newCell.innerHTML = OthersInnerHTML[i];
break;
case "Humidor_Table": newCell.innerHTML = WatchInnerHTML[i];
break;
}
}
// Update the Index Counters
switch (DIV)
{
case "Intro_Table": IntroIndex++;
break;
case "Image_Table": ImageIndex++;
break;
case "Watch_Table": WatchIndex++;
break;
case "Others_Table": OthersIndex++;
break;
case "Humidor_Table": HumidorIndex++;
break;
}
}
when the page is loaded, the Init() function is started, that code is here:
function Init()
{
AddRow(1, "Intro_Table");
AddRow(1, "Image_Table");
AddRow(1, "Watch_Table");
AddRow(1, "Humidor_Table");
AddRow(1, "Others_Table");
}
Did i miss something? there must be something i've over looking. I have even tried isolating some other external JS, and CSS includes that i have, and isolating them has no change in the result.
the html file is live here:
http://kevinjohnson.clanteam.com/XML-App/ManageSite.html
thanks :)