如何使用JavaScript禁用控件 [英] How to disable the control using javascript

查看:127
本文介绍了如何使用JavaScript禁用控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的应用程序中,我使用了两个带有某些单选按钮列表的gridview控件.在两个网格中,我都使用具有值为是"或否"的AcceptID单选按钮列表.当用户在两个网格中将AcceptId值选择为Yes时,我想启用gridview之外的一个字段.如果用户在两个网格中选择任一行作为acceptid作为No,那么我想禁用该字段.如果他在两个网格中都将acceptid的所有值都选择为Yes,则只有我要启用该控件,否则应将其禁用.我已经在一个网格中使用了javascript,以禁用并启用了效果良好的控件.我需要两个网格的javascript.谁能帮我解决这个问题


在此先感谢

Hi,

In my application I am using two gridview controls with some radio button list. In both the grids I am using the AcceptID radiobutton list with the values Yes or NO. When the user selects the AcceptId value to Yes in both the grids then I want to enable one field outside the gridview. If the user selects any row in both the grid as acceptid as No then I want to disable that field. If he selects all the values of acceptid as Yes in both the grids then only I want to enable that control otherwise it should be disabled. I have used the javascript for one grid for disabling and enabling the controls it worked fine. I need the javascript for both the grids. Can anyone help me to solve this issue


Thanks in Advance

推荐答案

通过使用任何HTML控件元素的属性disabled.请参阅:
http://www.w3schools.com/tags/att_input_disabled.asp [ http://www.w3schools.com/jsref/prop_pushbutton_disabled.asp [
By using the attribute disabled of any HTML control element. Please see:
http://www.w3schools.com/tags/att_input_disabled.asp[^],
http://www.w3schools.com/jsref/prop_pushbutton_disabled.asp[^] (JavaScript for button, but it can be any control).

—SA


document.getElementById( ''btnSubmit'' ).disabled=''true'';
document.getElementById( ''btnSubmit'' ).disabled=''false'';


document.getElementById( "<% =txt.ClientID%>").disabled=true


这篇关于如何使用JavaScript禁用控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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