Open new browser window in ASP.net. What i am doing wrong?

M

Miguel Dias Moura

Hello,

i want to open a new window when a button is clicked. I am working in
ASP.net / VB. However my code is not working.

This is my Script Code:

<script runat="server">

Private Sub openNewWindow(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Response.Write("<script>window.open 'http://www.google.com', '_new',
'width=400, height=200, status=no, toolbar=no, menubar=no, location=no');
</script>")
End Sub

</script>

and this is my Button Code:

<asp:Button CssClass="button" ID="buttonID" runat="server" Text="Go"
onClick="openNewWindow"/>

Can you tell me what am i doing wrong?

Thank You,
Miguel
 
M

Marcos MOS

you should to use <script language='JavaScript'> instead of <script>

right?

best regards,
Marcos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top