Hey guys, I need your help because I don’t know what’s wrong with my code.
What I am trying to do, is as easy as display a (big) table with random colors. I am using this thing as a engine for… something bigger, like displaying an image in a table, using the cells as pixels. I have that part already covered.
But my code seems to be unable to display the table. I am trying to display the table using a <div>, but when I run it, it doesn’t display the table.
Here’s the relevant code:
[CODE]function DrawFrame() {
document.getElementById(“debug”).innerHTML += ‘<table border=1><tr>n’;
for(n = 0; n < frame.length; n++){
document.getElementById(“debug”).innerHTML += ‘<td bgcolor=”‘ + palette[frame[n]] + ‘”></td>n’;
curline++;
pixel++;
document.getElementById(“debug2”).innerHTML = “#” + palette[frame[n]];
if(curline >= lines){
curcol++;
curline = 0;
document.getElementById(“debug”).innerHTML += ‘</tr><tr>n’;
if(curcol >= columns || pixel >= (lines*columns)){
document.getElementById(“debug”).innerHTML += ‘</tr>n</table>’;
break;
}
}
}
return;
}
The code seems to execute well, except for the table not showing. No table, no colors… nothing. If I put some text, it shows the text. If I put the value of a variable, it shows the value of the variable, but not the table. The DIVs are properly created in HTML
[CODE]<body onload=”BegginProgram();”>
<div id=”debug”></div>
<div id=”debug2″></div>
</body>
NOTE: [I]BegginProgram
The problem is, I don’t know what the problem is, and I am unable to locate the problem. The HTML seems to be right, and also the JavaScript code, so I don’t know what the problem is…
I hope you can help me. Thanks in advance for your time.