How does let the browser of IE to care about the value returned from the client script?(that is the exact subject, too long to fit the Subject box)
I met a problem is about confirm diaglog box added on a button. No matter I clicked OK or Cancel, even I clicked X to close the pop up dialog, the page always post back.
I used web visual developer 2005 express (VB
). The code I used to test was as follow.
<form id="form1" runat="server">
<asp:Button ID="Button1" runat="server" Text="Click Me" />
<asp:Label ID="Label1" runat="server"></asp:Label> </div>
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Button1.Attributes.Add("onclick", "return confirm('Are you sure');")
Label1.Text = "Page post back."
After tested in IE 6.0, I am sure that the confirm diaglog did the right job. It returned the False value if I clicked Cancel button. But the browser doesn't care about the return value from script, continutely submit the form.
Later, I tested the code in the FireFox, it worked.
So What's wrong with the IE browser? Is there a setting problem?
I really appreciate your help!!