Add the code as follows in aspx page <INPUT id="InfoSave" title="曐懚" style="WIDTH: 76px" onclick="javascript:return ConSave();"type="button" value="曐懚" name="InfoSave" tabIndex="13"><asp:button id="btnSave" runat="server" Width="1px" BackColor="Transparent" BorderColor="Transparent" Enabled="False" BorderStyle="None" Text=" "> function ConSave(){ if(confirm("Message")) { __doPostBack('btnSave',''); } }When showing the page, the user just only sees InfoSave button. When click the InfoSave button, it will pop up one message. If click ok button, it will run the event of btnSave button which in CS file.maybe it can help you.
点取消什么都不做
点确定继续网下执行
不需要判断,就看你要把你需要执行的代码放在哪里
还是需要一些技巧的,呵呵
给你的Button.Attributes.Add("onclick","return confirm('xx?');");然后随意在你的Button.Click里面写方法即可
如果像你这样的话是不是只有手动点击按钮时才有用呢,可是我想不需要用户的任何动作就触发一个事件怎么办呢
alert('ok');
}else{
alert('cancle');
CONFIM在客戶端﹐按是和否來改變一個服務器控件(如TEXTBOX)的值﹐然后在CS文件中根據這個TEXTBOX的值來判斷是和否~~~~~~
所说的方法不行呀,我获取不到TEXTBOX已修改的值.等到判断页面已刷新了
<INPUT id="InfoSave" title="曐懚" style="WIDTH: 76px" onclick="javascript:return ConSave();"type="button" value="曐懚" name="InfoSave" tabIndex="13"><asp:button id="btnSave" runat="server" Width="1px" BackColor="Transparent" BorderColor="Transparent" Enabled="False" BorderStyle="None" Text=" ">
function ConSave(){
if(confirm("Message"))
{
__doPostBack('btnSave','');
}
}When showing the page, the user just only sees InfoSave button. When click the InfoSave button, it will pop up one message. If click ok button, it will run the event of btnSave button which in CS file.maybe it can help you.