I think you need to save the test code as *.html and try it separately. You won't see the bug when it's rendered server-side by a CGI script. Try it separately to confirm bug exists.
This is a mass search for bugs which are in the Firefox General component, are UNCO, have not been changed for 500 days and have an unspecified version. Reporter, can you please update to Firefox 3.6.10 or later, create a fresh profile, http://support.mozilla.com/en-US/kb/managing+profiles, and test again. If you still see the issue, please update this bug. If the issue is gone, please set the status to RESOLVED > WORKSFORME.
Updated to Firefox 3.5.13 on Windows 64. Bug no longer there.