there is a long standing IE bug (since 5.5) where returning false doesn't
cancel the event as it should.
function cancelEvent()
{
// ie hack
if (window.event) window.event.cancelBubble = true;
return false;
}
<asp:LinkButton
OnClick="DeleteFile"
OnClientClick="if (!confirm ('Are you certain you want to delete
this file?') ) return cancelEvent();"
runat="server"
ID="DeleteButton">DELETE
</asp:LinkButton>
-- bruce (sqlwork.com)
> Here's my code:
>
[quoted text clipped - 10 lines]
>
> Thanks!
David C - 14 Dec 2007 20:16 GMT
I use this kind of thing very often and have never had a problem with IE6 or
IE7. The only difference is I create a separate confirmdel() Javascript
function and use something like this.
function confirmdel(deltype)
{
if (window.confirm('Are you sure you want to delete this ' + deltype
+ '?') == false)
{
return false;
}
}
On the LinkButton I use OnClientClick="return confirmdel('file');"
HTH
David
> there is a long standing IE bug (since 5.5) where returning false doesn't
> cancel the event as it should.
[quoted text clipped - 30 lines]
>>
>> Thanks!