如何找到选中的复选框不在JavaScript中使用javascript [英] How to find the checkbox checked are not in javascript using in asp.net

查看:81
本文介绍了如何找到选中的复选框不在JavaScript中使用javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上在我的项目中,我有两个复选框(CheckBox1,CheckBox2)。我需要实现的是,如果我选中checkbox1意味着checkbox2应该消失。如果我取消选中意味着它应该是可见的。如果我选中checkbox2意味着复选框应该消失,如果我取消选中意味着它应该可见,它应该与checkbox2相同。我可以通过asp.net中的javascript实现这种功能

Actually in my project i am having two check boxes (CheckBox1,CheckBox2). what i need to achieve is if i checked the checkbox1 means checkbox2 should be disappear. if i uncheck means it should be visible . same thing it should hapend to checkbox2 if i check checkbox2 means checkbox should disappear and if i uncheck means it should visible. this type of functionality can i achieve through javascript in asp.net

推荐答案

这可能对你有所帮助...



复选框的可见性 [ ^ ]





在javascript中检查了复选框 [ ^ ]
this might help you...

Visibility of checkbox[^]


checkbox checked in javascript[^]


var chkStatus1 = document.getElementById("chkbutton1");
var chkStatus2 = document.getElementById("chkbutton2");

if (chkStatus1.checked) {
    // do your implementation for if part
}
else if(chkStatus2.checked)
{
   // do your implementation for else if part for checkbox2
}
else if(chkStatus2.checked && chkStatus2.checked)
{
   // do your implementation when two chechbox status is checked.
}
else
{
   // do your implementation for else part.
}


这篇关于如何找到选中的复选框不在JavaScript中使用javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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