Hi.

I have the code below with 9 buttons. When i click button one the for-loop must update the variable to 1.
When i click the same button again the variable value will be 2 and so on.

The for-loop below dosn't work it just put out each number up to 400.

The same funktion i want in the other 8 buttons, when i click it one time its variable value will be 1 and by a second click its variable will be one.

When clicking a buttone and a variable update i want to automatic go back to the button view page.

To the rigth for the page i want a table with each variable is displayed as shown in this image: http://www.diskusjon.no/uploads/mont...1501_thumb.gif

Can anyone help me?


Code:
<!DOCTYPE html>
<html>
<head>
<script>
function kunnskap1()
{

for (var i = 1; i <= 400; i++) {
document.writeln(i);
}

document.writeln("hei");

}

function kunnskap2()
{

document.writeln("hei2");

}

function kunnskap3()
{

document.writeln("hei3");

}

function kunnskap4()
{

document.writeln("hei4");

}

function kunnskap5()
{

document.writeln("hei5");

}

function kunnskap6()
{

document.writeln("hei6");

}

function kunnskap7()
{

document.writeln("hei7");

}

function kunnskap8()
{

document.writeln("hei8");

}

function kunnskap9()
{

document.writeln("hei9");

}


</script>
</head>

<body>

<button onclick="kunnskap1()">1</button>
<button onclick="kunnskap2()">2</button>
<button onclick="kunnskap3()">3</button>
<button onclick="kunnskap4()">4</button>
<button onclick="kunnskap5()">5</button>
<button onclick="kunnskap6()">6</button>
<button onclick="kunnskap7()">7</button>
<button onclick="kunnskap8()">8</button>
<button onclick="kunnskap9()">9</button>


</body>
</html>