SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jan 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    focus() not working in Netscape

    Hi, I have following HTML page. Problem is that on clicking "Click here 1" and then on "Click here 2" the window doesn't get focus (doesn't open) in Netscape. In IE it works fine.
    <!--
    <html>
    <script>
    <!--
    function showHelp(flag) {
    newwindow=window.open('','name','width=350,height=200,0,status=0,');
    var tmp = newwindow.document;
    if(flag == '1') {
    tmp.write('<html><head></head><body>Hello world</body></html>');
    }
    else if(flag == '2') {
    tmp.write('<html><head></head><body>Good Bye</body></html>');
    }
    tmp.close();
    tmp.focus();
    }
    -->
    </script>
    <body>
    <a href="javascript:showHelp('1');">Click here 1</a><br>
    <a href="javascript:showHelp('2');">Click here 2</a><br>
    <a href="javascript:showHelp('1');">Click here 1</a><br>
    <a href="javascript:showHelp('2');">Click here 2</a><br>
    <a href="javascript:showHelp('1');">Click here 1</a><br>
    <a href="javascript:showHelp('2');">Click here 2</a><br>
    </body></html> -->

  2. #2
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I tried this in Firefox. The problem is that on clicking the first link (any of them) the script runs then throws the error tmp.focus is not a function.

    newwindow.focus(); works though.
    Ian Anderson
    www.siteguru.co.uk

  3. #3
    SitePoint Member
    Join Date
    Jan 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This solved my problem
    Thanks a lot for your prompt reply.

  4. #4
    SitePoint Member
    Join Date
    Jan 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Another problem arose,
    Java console says,
    Error: [Exception... "'Permission denied to get property XULElement.accessible' when calling method: [nsIAccessibleProvider::accessible]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)".............

    Problematic line is,
    newwindow=window.open('','name','width=350,height=200,0,status=0,');


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •