ASP.Net javascript "focus" method needs to be called twice??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • getmyemails2@yahoo.com

    ASP.Net javascript "focus" method needs to be called twice??

    Hello,

    I am using the script below to open a new window and once opened,
    redirect to that open window from the original window:

    private void btnNewPDFWindow _Click(object sender, System.EventArg s e)

    {

    string NewPage = "NewPageZoom.as px";

    string ScriptBlockNewP age = "<script language='javas cript'>var
    NewPDFPage=wind ow.open('" + NewPage + "','PDFPage');" ;

    ScriptBlockNewP age = ScriptBlockNewP age +
    "NewPDFPage.foc us();</script>";

    Response.Write( ScriptBlockNewP age);

    }
    For some reason, with the code above, I have to click the button twice
    in order to get it to focus to the 2nd window again.
    Any ideas?

    Regards,

    TC

  • Rob B

    #2
    Re: ASP.Net javascript &quot;focus&quo t; method needs to be called twice??

    TC wrote:
    [color=blue]
    > Hello,[/color]
    [color=blue]
    > I am using the script below to open a new window and once opened,
    > redirect to that open window from the original window:[/color]
    [color=blue]
    > private void btnNewPDFWindow _Click(object sender, System.EventArg s e)[/color]
    [color=blue]
    > {[/color]
    [color=blue]
    > string NewPage = "NewPageZoom.as px";[/color]
    [color=blue]
    > string ScriptBlockNewP age = "<script language='javas cript'>var
    > NewPDFPage=wind ow.open('" + NewPage + "','PDFPage');" ;[/color]
    [color=blue]
    > ScriptBlockNewP age = ScriptBlockNewP age +[/color]
    "NewPDFPage.foc us();</script>";
    [color=blue]
    > Response.Write( ScriptBlockNewP age);[/color]
    [color=blue]
    > }
    > For some reason, with the code above, I have to click the button twice
    > in order to get it to focus to the 2nd window again.[/color]
    Any ideas?
    [color=blue]
    > Regards,[/color]
    [color=blue]
    > TC[/color]

    Might be a timing issue, the result of the page being cached for the
    second load. pdfs take forever. Wild guess:

    ScriptBlockNewP age = ScriptBlockNewP age +
    "setTimeout('Ne wPDFPage.focus( );',100);</script>";

    That's 100 msec, negotiable.

    Replace that "language" attribute with the proper mimetype:

    -----> type="text/javascript"


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!

    Comment

    Working...