如何根据条件通过javascript启用/禁用控件 [英] how to enable/disable controls based on conditions through javascript

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

问题描述


我在禁用和启用控件方面遇到问题..

1.i有页面,因为我直接在页面上有一些用户控件..
2.i在同一页面上也有一个向导控件.每个向导步骤都包含一个用户控件.
我必须将向导步骤设置为只读..用户可以浏览下一个秘密步骤..但不能进行编辑..

我使用了一个如下的javascript函数..但是问题是它禁用了页面上的所有控件..我无法导航到下一个或上一个步骤..

函数DisableControls(){
$("form:input").attr("disabled","disabled");
};


请帮我...
我需要做的另一件事是,仅将向导控件设置为只读,而无需将其他用户控件直接放置在页面上

在此先感谢...


i have problems with disabling and enabling controls..

1.i have page in that i have some user controls directly on the page..
2.i have a wizard control on the same page as well..each wizard step contains a user control.
i have to make the wizard steps to be readonly..user can navigate through next and privious steps..but not be able to edit..

i have used one javascript function as below..but the problem is that it is disabling all the controls on the page..i m not able to navigate to next or previous steps..

function DisableControls() {
$("form :input").attr("disabled", "disabled");
};


plz help me...
one more thing i need to make only wizard control as readonly not other user controls that are directly placed on page

thanks in advance...

推荐答案

("form:input").attr("disabled","disabled"));
};


请帮我...
我需要做的另一件事是,仅将向导控件设置为只读,而无需将其他直接放在页面上的用户控件设置为

在此先感谢...
("form :input").attr("disabled", "disabled");
};


plz help me...
one more thing i need to make only wizard control as readonly not other user controls that are directly placed on page

thanks in advance...


然后再启用这两个控件.或更改选择器.
使用
Then just enable those 2 controls, after that. Or change selector.
Use
control.ClientId


要在客户端获取控件ID,然后将其用于Jquery选择器.
但这并不优雅,因为您混合了服务器标签和javascript.
难道您不希望看到服务器事件吗?


To obtain control id on the client side and then use it Jquery selector.
But that is not elegant since you mixing server tags and javascript.
Cant you acomplish that trough server events?


function DisableControls() {


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

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