Let me see if I understand right: You want to make it so that when a user tries to move the cursor out of the field, the onBlur event fires and re-focuses it, so they can't leave the field? If so, two things come to mind.
First, in the HTML code you show, you are calling the reFocus function on the onFocus event... shouldn't it be the onBlur event?
Second, you can make it much simpler by passing the this object to the function in the onBlur event, like this:
Code:onBlur="reFocus(this)"
Then the
reFocus function becomes:
Code:function reFocus(obj){
obj.focus();
}
Hope that helps.
Enter your message below
Sign in or Join us (it's free).