When buying items from the npc shops, it's really annoying how you'll be in the middle of typing the captcha code (having already typed in the sp amount) and then the cursor will jump back to the sp section in the middle of typing and if you don't catch it before you hit enter, it completely messes up your captcha code.
This is actually a browser issue, where the Javascript finishes loading before the autofocuser (what moves your cursor into a box when the page loads) runs.
The easiest way to prevent this is to hit ESC or the X button on the URL bar to stop the page from loading further as soon as all the elements you need are displayed.