Get ready for BLACK FRIDAY shopping starting in

Forums

ASP

This topic is locked

Arrays and Sessions

Posted 18 May 2004 15:24:27
1
has voted
18 May 2004 15:24:27 Jon McGee posted:
[edit] I have a hidden field working so it inserts a value from a form into my array (arrayOne). However Im having difficulty inserting this array into a session. If I put my session code outside the array code it says the session variable is undefined. And if i put it within the array code nothing happens.
Here's the array code:
<pre id=code><font face=courier size=2 id=code>&lt;script language="Javascript"&gt;
var arrayOne = Array( );
var arrayTwo = Array("y","n","n";

function performUpdate(value, theArray){
var theIndex = addToArray(value, theArray);
arrayTwo = updateSecondArray(theIndex, arrayTwo);
}

function addToArray(value, theArray){
theArray[theArray.length] = value + '_new'
theArray.sort()

for(i=0;i&lt;theArray.length;i++){
if(theArray[i].indexOf('_new') != -1){
theArray[i] = theArray[i].replace('_new','');
return i
}
}
}

function updateSecondArray(index, theArray2){
var j=0;
var tempArray = new Array();
while(theArray2.length != 0){
if(j != index)
tempArray[tempArray.length] = theArray2.shift();
else
tempArray[tempArray.length] = 'the new value was entered here';
j++
}
}
&lt;/script&gt; </font id=code></pre id=code>
And here's the session code <pre id=code><font face=courier size=2 id=code> Session("arrayOne" = arrayOne</font id=code></pre id=code>.
Any ideas as to how I can get the array into the session var correctly?
Thanks
Jon

Edited by - jonny mags on 19 May 2004 12:23:50

Reply to this topic