如何启用控件 [英] how to enable controls

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

问题描述

我希望启用所有控件mns textbox,buttonc,dropdownlist on button click ... mns所有控件一次启用。我有多个文本框所以,我不能写每个textboxid.enabled = true ..这是非常繁琐的工作.plz帮帮我?

解决方案





把它放在面板中的所有控件

点击按钮



panelid.Enable = true;


你可以尝试全部启用单击按钮时使用Jquery控件。只需为每次单击一次启用控件提供相同的类名。



 <   html  >  
< head >
< script src = jquery.js > < / script >
< < span class =code-leadattribute> script type = text / javascript >
var submit_Click = function(){


(。class1)。attr(disabled,false);
}



< / script >
< / head >
< body >

< 表格 >

< ; 输入 type < span class =code-keyword> = text = tdfgfhfhgfhgf id = txt1 class = class1 已禁用 = < span class =code-keyword> true >
< span class =code-keyword>< input type = textarea value = tdfgfhfhgfhgf id = txt2 class = class1 已禁用 = true >
< 输入 类型 = text value = tdfgfhfhgfhgf id = txt3 class = class1 已禁用 = true >
< 输入 类型 = text value = tdfgfhfhgfhgf id = txt4 class = class1 已禁用 = true >

< 输入 type = button value = 提交 < span class =code-attribute> onClick = submit_Click(); >

< / form >

< / body >
< / html >


i want enabled all controls mns textbox,buttonc,dropdownlist on button click...mns all controls enabled at one time.i have multiple textboxes so, i cant write every textboxid.enabled=true..it is very tedious job.plz help me?

解决方案

Hi,

Put it all the controls in panel
On button click
write
panelid.Enable=true;


You can try enabling all controls using Jquery on single button click.Just give same class name to each control which you want to enable at a time on single click.

<html>
<head>
<script src="jquery.js"></script>
<script type="text/javascript">
var submit_Click=function(){


(".class1").attr("disabled", false); } </script> </head> <body> <form> <input type="text" value="tdfgfhfhgfhgf" id="txt1" class="class1" disabled="true" > <input type="textarea" value="tdfgfhfhgfhgf" id="txt2" class="class1" disabled="true"> <input type="text" value="tdfgfhfhgfhgf" id="txt3" class="class1" disabled="true"> <input type="text" value="tdfgfhfhgfhgf" id="txt4" class="class1"" disabled="true"> <input type="button" value="Submit" onClick="submit_Click();"> </form> </body> </html>


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

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