Hans-Joerg
10-22-2003, 02:59 PM
Hi,
me problem is, that I want to use an Array to store data on it and use it lateron in serveral functions.
I declared an array like this:
<BODY>
<script language="JavaScript">
<!--
var i = 1 ;
var MeinArray = new Array(100);
//-->
</script>
Lateron I want to use this Array in another function, which I declared in the <HEAD> section.
It looks like:
function sammle(x)
{
var x;
/*document.write("bin drin");*/
document.write(i);
/*MeinArray[i]=x;
document.write(i);
document.write(MeinArray[i]);*/
if ( i == 100 )
{
document.write("HaltStop 100");
}
if ( MeinArray[i] == "Enter" )
{
document.write("Berechne");
}
i++;
}
Now, at runtime I get the answer that "MeinArray" is not definded
in this particlure function.
I knew, that variable must be declared as globol for to use it
in all "places". But I cant find any hint what's about array declarations. Is it possible to use the same array in several functions, whithout losing data?
Best Regards
Hans-Joerg
me problem is, that I want to use an Array to store data on it and use it lateron in serveral functions.
I declared an array like this:
<BODY>
<script language="JavaScript">
<!--
var i = 1 ;
var MeinArray = new Array(100);
//-->
</script>
Lateron I want to use this Array in another function, which I declared in the <HEAD> section.
It looks like:
function sammle(x)
{
var x;
/*document.write("bin drin");*/
document.write(i);
/*MeinArray[i]=x;
document.write(i);
document.write(MeinArray[i]);*/
if ( i == 100 )
{
document.write("HaltStop 100");
}
if ( MeinArray[i] == "Enter" )
{
document.write("Berechne");
}
i++;
}
Now, at runtime I get the answer that "MeinArray" is not definded
in this particlure function.
I knew, that variable must be declared as globol for to use it
in all "places". But I cant find any hint what's about array declarations. Is it possible to use the same array in several functions, whithout losing data?
Best Regards
Hans-Joerg