Basic Javascript: onclick event not working
<p>Given this simple javascript function:</p>

<pre><code>function update_cart() {
alert("--update--");
document.form1.command.value="update";
document.form1.submit();
}
</code></pre>

<p>and this button at the bottom of my form:</p>

<pre><code>&lt;input type="submit" value="Update" onclick="update_cart()" /&gt;
</code></pre>

<p>The data in the form is 'submitted' to the new URL. but the update_cart function is never called. I know because I never get an alert box, and the URL reads...?c=Albania&amp;m=.... </p>

<p>Also, the form element</p>

<pre><code>&lt;input type="hidden" name="command"/&gt;
</code></pre>

<p>does not get posted to the URL, either. URL reads ?command=&amp;c=Albania...</p>

<p>I have tried  the following: changed onclick to onsubmit, checking $_REQUEST variables, cutting and pasting the code from known working pages.</p>

<p>I'm at my wit's end, and would be grateful for any help!</p>

<p>Oh, yes: same behaviour in firefox 6, Opera 11.5, &amp; IE7. I'm running WinXP SP3.  </p>

<p>Thanking you,
Sadhu!</p>
