代码如下:
<head runat="server">
<title></title>
<script type="text/javascript">
function myClick() {
if (confirm("你確定要刪除嗎?")) {
return true;
}
else {
return false;
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" OnClientClick="return myClick();" OnClick="Button1_Click"
Text="Button" />
</div>
</form>
</body>
後臺代碼
复制代码代码如下:
protected void Button1_Click(object sender, EventArgs e)
{
Button1.Text = "Hello World";
//在這裏寫刪除數據庫裏數據的代碼。
}