那种不选择 确定或者取消 messagebox就无法始终前端且无法取消使如何实现的?本人菜鸟求指点。或者说用ajax来实现 那下面代码为何实现不了删除操作呢?<asp:Button id="btnDelete" runat="server" Text="Delete" PostBackUrl="UserAlbum.aspx"
OnClientClick='var x = confirm("Are you sure you want to delete this photo?");
if (x == true) {
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} xmlhttp.open("get", "~/Scripts/DeletePhoto.asp?PhotoID=<%# Eval("PhotoID") %>" , false);
alert("You are confirmed.");
xmlhttp.send();
}
' onclick="btnDelete_Click1" />
OnClientClick='var x = confirm("Are you sure you want to delete this photo?");
if (x == true) {
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} xmlhttp.open("get", "~/Scripts/DeletePhoto.asp?PhotoID=<%# Eval("PhotoID") %>" , false);
alert("You are confirmed.");
xmlhttp.send();
}
' onclick="btnDelete_Click1" />
OnClientClick='return confirm("Are you sure you want to delete this photo?")' />这样既可
你这样我试了 直接出现错误了 变成了拉取控件的错误
我这个就是在dataview中加的一个deletebutton ···
这个confirm语句 点击确定后返回的是true值吗?
怎么调试···alert怎么写来着···谢啦···
中的<%# Eval("PhotoID") %>改成了一个数PhotoID=1就能弹出confirm了 但是还是无法实现删除是怎么回事呢
前辈 我就是想用ajax 但是我刚开始入门 时间紧迫来不及 只能用这个改了 而且我觉得差不多了把····
<asp:Button id="btnDelete" runat="server" Text="Delete" PostBackUrl="UserAlbum.aspx"
OnClientClick='ajax();return false;' />function ajax()
{
if(confirm("delete?"))
{
xmlhttp去删除。
}
}这样就可以使用ajax了
{
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} xmlhttp.open("get", "~/Scripts/DeletePhoto.asp?PhotoID="+xx , false); xmlhttp.send();
}<asp:Button id="btnDelete" runat="server" Text="Delete" PostBackUrl="UserAlbum.aspx"
OnClientClick='ajax();return false;' />\
改成
<asp:Button id="btnDelete" runat="server" Text="Delete" PostBackUrl="UserAlbum.aspx"
OnClientClick='<%# "ajax(" + Eval("PhotoID") + ");return false;" %>' />
是直接拖到 aspxdataview 的