Hello

I have a problem by accessing an array over 2 webpages. On page 1 i need the user to fill in text in a text box. After clicking a button the text must be stored in an array. On page 1 there is also a link to page 2. When page 2 opens after clicking the link i want to view the value off the array in a text area.

I have 2 functions written for this, i want to access the functions from a .js file so i can use them over multiple pages.

Code:

Page 1

<html>
<head>
<title>vb</title>
<script type="text/javascript" src="file.js"></script>
</head>
<body>
<input id="txt" type="text">
<br>
<input value="Click Me" onclick="getText();"
type="button">
<a href="fg.html">Klik dan hier !</a>
<br>
<br>
</body>
</html>

Page2

<html>
<head>
<title>fg</title>
<script type="text/javascript" src="file.js"></script>
</head>
<body onload="writetext()">
<textarea rows="5" id="txtArea"></textarea>
</body>
</html>

file.js

var list = [];

function getText() {
var str = document.getElementById("txt");
list.push(str.value);
str.value = "";
str.focus();
}

function writetext() {
var area = document.getElementById("txtArea");
area.value = "";
for (var i = 0; i < list.length; i++) {
area.value += list[i] + "\n";
}
}

Can someone tell me what the problem is?

Thanks