Javascript opens new window despite no call

Posted by Jimmy on Stack Overflow See other posts from Stack Overflow or by Jimmy
Published on 2011-02-14T12:20:07Z Indexed on 2011/02/15 7:25 UTC
Read the original article Hit count: 143

Filed under:
|

I have a javascript that opens a new window for "PreChecking" a site. The problem is when i click the button, it works fine... but wichever i button i press next makes the method fire again, despite i doesn't call it. Its just the button with id "lnkPrecheck" that should call the method. Have searched far and wide for a slolution that just opens a new window for the lnkPrecheck button, not the others on the site. THere must be a way for only 1 of 3 buttons makes the function call, not all of them!

The code:

<asp:Button OnClick="lnkPrecheck_Click" OnClientClick="NewWindow();" ID="lnkPrecheck" runat="server" text="Precheck (Opens in a new window)" />

    function NewWindow() {
            document.forms[0].target = "_blank";
}

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about ASP.NET