Unable to pass values to a function
<p>I have a function draw_integer(n,s,x,y,plotx) , which draws a integer ,n on HTML5 canvas of size s in the coordinates (x,y), I am calling this function inside another function draw_num() as follows,<br>
(plot0, number and size are the respective id's of canvas, number &amp; size input fields,
function drawnum() is being triggered with an onclick event.)</p>

<pre><code>function drawnum() {
    var n = document.getElementById('number').value;
    var s = document.getElementById('size').value;
    console.debug(n,s);
    draw_integer(n,s,100,100,plot0);   // this  doesn't get executed
    }   

function draw_integer(n,s,x,y,plotx){ //lots of code }
</code></pre>

<p>The draw_integer function being called under drawnum doesnt get executed, what is the problem I am unable to identify.</p>

<p>using console.debug() returns the appropriate values of number and size as entered by user, also if i use draw_integer(3,100,100,100,plot0) (draw number 3 of size 100) instead of draw_integer(n,s,100,100,plot0)  it works .</p>

<p>So that means that there is some error occuring while passing the varaible n and s from drawnum() to draw_integer().</p>

<p>Thinking that this might be due to to the local scope of the variables , I tried this.</p>

<pre><code>var n = document.getElementById('number').value;
var s = document.getElementById('size').value;

function drawnum() {
console.debug(n,s);
draw_integer(n,s,100,100,plot0);   // this  doesn't get executed
}   

function draw_integer(n,s,x,y,plotx){ //lots of code }
</code></pre>

<p>But that didn't work either.</p>

<p>can you help me out or suggest a better way to solve this problem .</p>
