Welcome to WebmasterWorld Guest from 184.72.177.182

Forum Moderators: open

Message Too Old, No Replies

JavaScript focus() problem in Opera

textbox loses focus immediately after gaining it

     
2:00 am on May 23, 2002 (gmt 0)

New User

10+ Year Member

joined:May 23, 2002
posts:4
votes: 0


I have a JS function that submits the content of a textbox, then clears it, and then attempts to put the cursor back in the textbox. The contents of the function are as follows:
document.dev_form.submit();

document.dev_form.message.value="";

document.dev_form.message.focus();

The entire function works fine in IE, but in Opera, the submit and clear work, but the focus has a problem. It seems that it focuses, but then "loses focus." (i.e. you see the mouse cursor appear in the textbox, but then it disappears).
Any ideas?
Thanks,
Edward
3:26 am on May 23, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 31, 2001
posts:1238
votes: 0


Hello ebynum,

Welcome to WebmasterWorld!

There have been some recent threads regarding Opera and javascript. There are limitations present.

focus() does not appear to be supported for use in a FORM.

Here is a link to Opera's .js tech specs: [opera.com...]

3:29 am on May 23, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 0


Welcome to the forums, ebynum.

I've run into occasional focus problems with Opera as well - and I haven't found a fix. I usually need to re-think my approach if I really need Opera support.

An interesting page here: The W3C Implementation Review of Opera 6 [w3.org].

The W3C rates Opera a "C" for complete in focus and selection conventions. However, as we've seen, there are quirks.