updating existing javascript variables
<p>This may or maynot be a simple question as i have very limited javascript skills. All i want to do is modify a variable in a function then return the new variable value ready for use in the funcion again.</p>

<p>An example of this is with a simple button that each time when clicked will deduct ten points from the variable. like a gradual countdown with each click. The problem is that the variable is not updated each time it is returned. </p>

<p>Maybe my starting approach to javascript is way out, thats why i dont seem to be able to find out much about this. here is the code</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;script type="text/javascript"&gt;

/*starting bank account*/
var bank = "200";
/* i want this function to deduct ten from the starting bank account and update the bank variable */
function Bank(bank) {
    var printout = document.getElementById("display_bank_result_here");
    bank = bank - 10;
    printout.innerHTML = bank;
    return bank;
}


&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;button onclick="Bank(bank)"&gt;remove 10 from bank&lt;/button&gt;
&lt;p id='display_bank_result_here'&gt;&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>A pre-emptive thanks to everyone out there. i hope one day i will have enough skills to return the favour to someone else in my posistion.</p>

<p>Robert</p>
