function shownumber(val) {
// XBM format
var Head = "#define count_width 8\n"+
"#define count_height 16\n"+
"static char count_bits[] = {";
var Count, dig, tag;
Digit = new Array();
Digit[0]=Head+"0xff,0xff,0xff,0xc3,0x99,0x99,0x99,0x99,"+
"0x99,0x99,0x99,0x99,0xc3,0xff,0xff,0xff};";
// ... sniped ....
for (Count = 0; Count < val.length; Count++) {
dig=val.substring(Count, Count+1);
tag="<IMG SRC='javascript:Digit["+dig+"]' "+
"HEIGHT=16 WIDTH=8 ALIGN='absmiddle'>";
document.write(tag);
}
}
When I run shownumber("0"), an XBM would be disaplayed. But if I changed
the declaration for the array to:
var Digit = new Array();
shownumber() would no longer work. Why? Everything is contained in the
function. Why can't I use local variable for the array?
--
.~. Might, Courage, Vision. In Linux We Trust.
/ v \ http://www.linux-sxs.org
/( _ )\ Linux 2.4.22-xfs
^ ^ 12:08am up 1 day 28 min load average: 1.00 1.00 1.00