G
Guest
Hi,
I have a form with Submit and cancel button. When Cancel button is clicked I
want to close the browser window. Here is my sample form. To make things
simple I have removed the submit button. When I click on the cancel button,
the window doesn’t close. Can someone tell me what mistake I am making here?
Thanks for your help,
Joe
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">
Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Response.Write("<script>self.close();<\/script>")
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" Runat="server" Text="Button"
OnClick="Button1_Click" />
</div>
</form>
</body>
</html>
I have a form with Submit and cancel button. When Cancel button is clicked I
want to close the browser window. Here is my sample form. To make things
simple I have removed the submit button. When I click on the cancel button,
the window doesn’t close. Can someone tell me what mistake I am making here?
Thanks for your help,
Joe
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">
Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Response.Write("<script>self.close();<\/script>")
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" Runat="server" Text="Button"
OnClick="Button1_Click" />
</div>
</form>
</body>
</html>