[thelist] javascript processing question

Alderson, Russ russ.alderson at Circle.com
Thu Apr 18 10:58:04 CDT 2002


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--
[ Picked text/plain from multipart/alternative ]
this seems to run beautifully on IE and Netscape on win2000, but no browser
on the mac can get past the first 'for' loop without returning 0 for the new
array's length property. it also failed on IE5 for windows NT4. much
obliged.
 russ alderson

<snip>

<head>
<script language="javascript" type="text/javascript"
src="js/glob.js"></script> <!-- contains the cat, file, path variables plus
getOtherCats function -->
<script language="javascript" type="text/javascript"
src="js/library.js"></script> <!-- contains the cats & imglib arrays -->
<script>
	thisCat = new Array();
	for (i=0; i<cats.length; i++) {
		tmpCats = cats[i].join("|");
		if (tmpCats.indexOf(cat) != -1) {
			thisCat.push(i);
		}
	}
</script>
</head>
<body>
<script>
document.write("<b>" + cat + "</b><br>" + thisCat.length + "
images<br><br>");
</script>
<table border="0" cellspacing="4" cellpadding="4">
<tr>

<script>
var count=0;
for (i=0; i<thisCat.length; i++) {
	var x = thisCat[i]
	document.write("<td valign='top'><a href='" + file + cat + "&" +
imglib[x][0] + "'><img src='" + path + imglib[x][0] + ".jpg' hspace='4'
vspace='4' border='0' alt='" + imglib[x][1] + "'  /></a><br /><small>" +
imglib[x][1] + "<br />" + imglib[x][0] + "<br />" + getOtherCats(x) +
"</small></td>");
	count++
	if (count==3) {
		document.write("</tr><tr>");
		count=0;
	}
}

</script>
</tr>
</table>
</body>

</snip>




More information about the thelist mailing list