How to get a value out of a JavaScript function?
<p>I need to get the row number out of a JavaScript function:</p>

<pre><code>function cap_check(){
    var row;

    $('td').change(function(){ 
        row = $(this).parent().parent().children().index($(this).parent());  
        alert(row);
    }); 

    alert(row);
}
</code></pre>

<p><em>Within</em> the function, <code>row</code> is correctly alerted. Outside of the function, it is <code>undefined</code>.</p>
