Obtain Focus on JavaScript Window

Discussion in 'JavaScript' started by bielen, Apr 6, 2009.

  1. #1
    I have the following snippet of HTML. I have an application I am passing userid/password credentials to login. When a user logs in, the application opens in a NEW window ("App1").

    If a user returns to this page and clicks the link again, I want the open window to come back into focus. I've tried multiple scripts to get it working without success. Any info is appreciated.


    <form action="details.asp" method="Post" name="App1" target="App1" id="App1" onSubmit="javascript: App1.focus();>
    <input name="username" type="text" id="username" value="username" />
    <input name="password" type="password" id="pssword" value="password" />

    <a href="javascript:document.App1.submit();">Open Web Page</a>

     
    bielen, Apr 6, 2009 IP
  2. joep1978

    joep1978 Peon

    Messages:
    30
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Add onload="self.focus();" to the bodytag of the page opening in the popup window
     
    joep1978, Apr 7, 2009 IP
  3. bielen

    bielen Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you. Using onload="self.focus();" works, but my other issue is that I do not necessary have access to the source of the application. I was thinking I could use the IFRAME as a container, but would like to avoid this option if possible. Any other thoughts are appreciated.
     
    bielen, Apr 8, 2009 IP