[Javascript] Memory Useage

Tim Makins spindrift at oceanfree.net
Mon Oct 27 14:58:06 CST 2003


Hi everyone - many thanks for your answers. It looks as if the best way is
to do a mock up and test it on an older computer - I just thought someone
might have experienced something like this before.

I certainly do need 6000+ entries, but don't worry, I had no intention of
putting everything in one drop-down. Rather, by a series of tests, the 6000+
will be whittled down to 100 for the actual drop down. However, the 6000+
will still need to be in a number of arrays to start with, hence the memory
question.

My audience - general public, running the page on a local machine, not on
the web. Manipulation - selecting a few from many based on sub-content of
each value. (example: '120056NYManhatten' - does it contain 'NY' at posn
6,7, are the 1st 3 chrs  > 100, etc. etc.)

I realise that the HTML overhead could be a problem, so decided on something
like this to keep the added characters to a minimum. (In actual useage, the
array declaration/poulation will be in a separate file) :

<html><head><title></title>

<script language="JavaScript" type="text/javascript">
var color_names = new Array("aliceblue", "antiquewhite", "aqua",
"aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue",
"blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate",
"coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue",
"darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkkhaki",
"darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred",
"darksalmon", "darkseagreen", "darkslateblue", "darkslategray",
"darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray",
"dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia")
</script>

</head>
<body>

<script language="JavaScript" type="text/javascript">

document.write("<form>")
document.writeln("<select>")

for (var counter = 0; counter < color_names.length; counter++) {
    document.writeln("<option value=\"" +
                     color_names[counter] + "\">" +
                     color_names[counter] + "<\/option>")
}

document.write("</select>")
document.write("</form>")
document.close()

</script>

</body>
</html>







More information about the Javascript mailing list