I was just playing with something ... and I hit a problem.

I wrote a quick spew system for a color table.
The Javascript is a bit complex for beginners, in my normal fashion, but you'll get the idea ( notice that stabArr is iterative, and calls back down a stack list - like an object handle in c++ ):

<script language="Javascript">
var hex = new Array('00','33','66','99','CC','FF');

var T = document.createElement('TABLE');

var Tr = T.insertRow(0);

var sC = new Array(0,0,0);
var pD = false;

function addCell(){
var Td = Tr.insertCell(Tr.cells.length);
with (Td.style){
backgroundColor = '#'+hex[sC[0]]+hex[sC[1]]+hex[sC[2]];
width = '10px';
height = '10px';
fontSize = '1px';
if (stabArr()){
else {

function stabArr(v){
var r;
if (!arguments.length) v = 2;
if (v<0) r = 0;
else r = 1;
sC[v] += 1;
if (sC[v] == hex.length){
sC[v] = 0;
Tr = T.insertRow(T.rows.length);
r = stabArr(v-1);
return r;



Now the problem is - when you scale the array up ( or call that array on a slow machine ) to:

You'll see you get an "out of memory" error.

I thought this might be to do with buffering the table - so I moved it to the top, as you see - that didn't work.
Instead I stopped using dynamic methods, and document.wrote the table, trs and tds... still a memory issue....

Please DON'T go assuming I want a script similar to what
I'm doing - I don't - I just want to see how to get this one
to work... I'm not really interested in the outcome at all,
I'm just playing - it's the error that's getting me.

Any thoughts...

p.s. You should find the script above works on your pc...
it's when you scale the array size up that it hits problems.