Click to See Complete Forum and Search --> : help with a javascript array


kitykity
07-04-2003, 07:57 AM
Hello there! I need help with this page:

http://www.kitykity.com/photoalbum/newalbum.html

It's a javascript photo album that I've created from scratch, and been working on over time. The newest addition is the category feature. I have it set up so that there is a category listed in each multidimensional array item. The script pulls lines out of the Mainarray that are in that category, and puts them into an Activearray. The problem is, that the correct items aren't showing up when you select a category; I'm thinking that you have to empty out an array before you add new items to it? How do you do that?

Charles
07-04-2003, 08:09 AM
<script type="text/javascript">
<!--
giantSays = ['fee', 'fie', 'foe', 'fum']
giantSays.length = 0;
giantSays.push('foo');
alert (giantSays)
// -->
</script>

kitykity
07-04-2003, 11:56 AM
Why, thank you! I've never worked with the push before... but the way I did solve it on the page temporarily was to do an ActiveArray.length--; until the array was empty... then just made new array elements. I take it the push adds something new to the end of the array...?

SlankenOgen
07-04-2003, 12:16 PM
see also pop, shift and unshift