Trouble with Web Setfocus

A few years ago I have made a barcode scanning App for desktop. I am now converting it to web. It all functions properly except I cannot set the focus back to the textfield for the next scan.

I am using [quote]textfield.setfocus[/quote]

Can anyone give me any pointers?