javascript中的asp.net复选框确认 [英] asp.net checkbox confimation in javascript

查看:73
本文介绍了javascript中的asp.net复选框确认的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



VB.net,VS2010
我有3个复选框,如果用户选中该复选框,则应在msgbox中要求确认.如果单击确定",则它将运行代码;如果单击取消",则应取消操作并刷新页面,以便错误选中的框将保持其原始状态.

请对此提供帮助

谢谢
Joe

Hi,

VB.net, VS2010
i have 3 checkboxes, if the user checks the box it should ask for a confirmation in a msgbox. if OK is clicked then it should run the codebehing, if CANCEL is clicked then it should cancel the operation and refresh the page so that the wrongly checked box would retain its original state.

please help on this

thanks
Joe

推荐答案



试试这个

Hi,

try this

function f2(tid) {
        if (confirm("Are you Sure?")) {
          //do your code
        }
        else {
            document.getElementById(tid).checked = false;
        }



和设计



And design

<table width="50%" align="center" id="dt1">
           <tr> <td>   <input type="checkbox" id="ch1" onclick="f2(this.id)"  />
               </td>
           </tr>
           <tr>
               <td>
                   <input type="checkbox" id="ch2" onclick="f2(this.id)" />
               </td>
           </tr>
           <tr>
               <td>
                   <input type="checkbox" onclick="f2(this.id)"  />
               </td>
           </tr>
           <tr>
               <td>
                   <input type="checkbox" />
               </td>
           </tr>
         </table>



最好的



All the Best


这篇关于javascript中的asp.net复选框确认的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆