That's no reason why it can't be in a form. But it doesn't have to be anyway. There are many ways to access an element as an object and give it focus. Only certain elements can receive focus though. But you're in luck, a text input is one of them. Or do you mean a textarea? That's one too, so either way you're covered. The easiest way would be, if doesn't already have one, to give it a unique id. Say it's a text input:
Code:
<input id="mytextfield" type="text">
Then you can give it focus with:
Code:
document.getElementById('mytextfield').focus();
Bookmarks