self.focus() not working in Opera?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • WH

    self.focus() not working in Opera?

    I put this line in HTML
    <body bgcolor="#FFFFF F" onLoad="focus() ">

    Both Mozzila and IE can do self.focus(). However Opera still does not take
    the focus().


  • Thomas 'PointedEars' Lahn

    #2
    Re: self.focus() not working in Opera?

    WH <kerry@whitehou se.gov> wrote:
    ^^^^^^^^^^^^^^
    You really want to refrain from spoiling namespaces
    and from using a faked From/Reply-To address, see

    <http://na.edit.client. yahoo.com/rogers/show_static?.fo rm=eua>
    <http://www.hispeed.rog ers.com/yahoo/info/eua.jsp>
    [color=blue]
    > I put this line in HTML
    > <body bgcolor="#FFFFF F" onLoad="focus() ">[/color]

    Do not use the "bgcolor" attribute without the "text", "link", "alink" and
    "vlink" attributes, and, even better, use CSS instead of deprecated format
    attributes.
    [color=blue]
    > Both Mozzila[/color]

    What?
    [color=blue]
    > and IE can do self.focus().[/color]

    But you cannot be sure that you call self.focus() here.
    [color=blue]
    > However Opera still does not take the focus().[/color]

    Does the JavaScript Console show error messages?

    Without an object reference in an intrinsic event handler attribute value,
    the scope chain is followed, so it could be that Opera interprets `focus'
    as `document.focus ', not `window.focus' == `self.focus'. That's also why
    it is bad to write only `open(...)' within an event handler attribute value
    as both the object referenced by `window' and the object referenced by
    `document' have an open() method according to DOM Level 0 (for `window')
    and DOM Level 0+ (for `document').

    It could as well be that the DOM of the Opera version(s) you have been
    testing with does not support Window.focus(). This method is part of
    the proprietary DOM Level 0, it can be supported by a standards compliant
    UA but does not need not to.

    But why would someone want to focus the window containing the currently
    loaded document, even if that worked?


    PointedEars
    --
    Never learn by your misstakes, if you do you may never dare to try again...

    Comment

    Working...