...

View Full Version : Hide focus away from textbox



htcilt
07-23-2009, 02:41 PM
Hi,

When the user hits the enter key I have some JS to click the button, which then says "Searching. Please Wait" and becomes disabled.

The cursor stays flashing in the textbox. I would like to take the focus away from the form elements. How can I do this?

Thanks

ckeyrouz
07-23-2009, 03:09 PM
try this:
document.formname.blur();

htcilt
07-23-2009, 03:19 PM
Works in Firefox (thank you), but not IE. IE6 at least anyway...

ckeyrouz
07-23-2009, 03:27 PM
or you can try


document.body.blur();

Philip M
07-23-2009, 03:52 PM
Or

"document.body.blur(); document.body.focus()";

htcilt
07-23-2009, 04:16 PM
Excellent thanks - the above 2 suggestions worked. There is a bit of a flash effect as the document gets focus back, but as least it takes away the focus from the textbox.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum