RSS feed
<< February 12, 2008 | Home | February 14, 2008 >>

Name pollution

This is one of those nasty javascript quirks that nails me every 5 years or so. See if you can spot it. The first form has a bug in the code, the submit2 button produces an error and doesn't work.

Form1


<form name="f1" action="./"><p>
<input type="submit" value="submit1" name="submit"><br/>
<input type="button" value="submit2" name="submit2" 
onclick="javascript: document.f1.submit();" />
</p></form>

Form2


<form name="f2" action="./"><p>
<input type='submit' value="submit1" name="submit1"><br/>
<input type="button" value="submit1" name="submit2" 
onclick="javascript: document.f2.submit();" />
</p></form>
<< February 12, 2008 | Home | February 14, 2008 >>