Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Javascript to open a new window


Message #1 by "Payal Parija" <pparija@y...> on Wed, 12 Mar 2003 17:16:34
Hi Piyush,

I saw your message below and it helped me a lot. Thanks.

However, in my case, the event I would like to use is the pressing of a 
key on your keyboard. So suppose the user enter some text on a text box. 
When he press enter, I would like to call a javascript function. 

In our example you show us how to achieve that with an <asp:LinkButton >. 
How can I do the same with the enter key??

Cheers,

Claudio 


> Hi,
I understand, You won't be able to directly call a client side function
on a Server side event. 
Instead it can be done like this:
            <script language="javascript">
                  <!--//
                  function OpenWindow(psUrl)
                  {
                        window.open(psUrl);
                  } 
                  //-->
            </script>
<asp:LinkButton id="LinkButton1" style="Z-INDEX: 110; LEFT: 559px;
POSITION: absolute; TOP: 111px"
runat="server">LinkButton</asp:LinkButton>
 
Adding this line in Page_load function will tie the function name to the
onclick event in html rendered in browser:
 
LinkButton1.Attributes.Add("onclick","ClientSideFunc()");
 
I hope this helps,
 
Regards,
Piyush
Piyush_prakash@i...
 
-----Original Message-----
From: Payal Parija [mailto:pparija@y...]
Sent: Wednesday, March 12, 2003 11:17 AM
To: ASPX_Professional
Subject: [aspx_professional] Javascript to open a new window
 
 
i have this in my aspx page to open a new window..
but i keep getting a parser error...server tag not well formed can
anybody tell me how to implement this... with the right syntax pls
 
 
<script language=3D"javascript">
                  <!--//
                  function OpenWindow(psUrl)
                  {
                        window.open(psUrl);
                  }=20
                  //-->
                  </script>
 
<asp:LinkButton id=3D"lbThes" OnClick=3D"OpenWindow("http://www.m-
w.com/home.htm")" runat=3D"server">here</asp:LinkButton>
 
Payal
 
 
 
 


  Return to Index