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(delt ype)
{
if (window.confirm ('Are you sure you want to delete this ' + deltype
+ '?') == false)
{
return false;
}
}
On the LinkButton I use OnClientClick=" return confirmdel('fil e');"
HTH
David
"bruce barker" <br*********@di scussions.micro soft.comwrote in message
news:57******** *************** ***********@mic rosoft.com...
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.ca ncelBubble = true;
return false;
}
<asp:LinkButt on
OnClick="Delete File"
OnClientClick=" if (!confirm ('Are you certain you want to delete
this file?') ) return cancelEvent();"
runat="server"
ID="DeleteButto n">DELETE
</asp:LinkButton>
-- bruce (sqlwork.com)
"dddan" wrote:
>Here's my code:
<asp:LinkButto n
OnClick="Delete File"
OnClientClick=" if (!confirm ('Are you certain you want to delete
this file?') ) return false;"
runat="server"
ID="DeleteButto n">DELETE
</asp:LinkButton>
Now, this works fine in FireFox but in IE7 on Vista it deletes the
file whether the user hits OK or Cancel. Any guidance/ideas?
Thanks!