如何从客户端禁用/启用 Ajaxifeid 按钮 (JavaScript)

发布于 2024-09-07 06:49:14 字数 484 浏览 2 评论 0原文

我有一个 AJAXIFIED 按钮(btnsend),它被它的属性禁用 -> Enabled =“False”

我在这个按钮旁边有一个文本框,我想当用户在该文本框中键入内容时启用该按钮...

所以我这样做了(JavaScript):

        function onkeyupontextbox() {
        var btnSend = document.getElementById("btnSend");
        btnSend.disabled = false;

}

但是该按钮在启用后不起作用...

我能做什么呢?

(我正在使用 radajaxmanager 来 ajaxify 该按钮) (当我从 RadAjaxmanager 或 UpdatePanel 中删除该按钮时,一切都正常,但我希望该按钮处于 Ajaxify 模式)

感谢您的关注...

i have an AJAXIFIED button(btnsend) thas is disable by it's Property -> Enabled="False"

i have a TextBox Next To This Button And I Want Enable that Button When Users Type Something in That TextBox...

so i did this (JavaScript):

        function onkeyupontextbox() {
        var btnSend = document.getElementById("btnSend");
        btnSend.disabled = false;

}

but that button does not work after becomes enable...

what can i do about that?

(i am using radajaxmanager for ajaxify that button)
(when i remove that button from RadAjaxmanager Or UpdatePanel So EveryThing Is Ok , But I Want That Button In Ajaxify Mode)

thanks for your attention...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

为人所爱 2024-09-14 06:49:14

听起来您正在尝试混合 Ajax 化属性和 DOM 元素属性。
当你ajaxify它时,保留属性Enabled =“True”,然后在页面加载时使用JS将其设置为btnSend.disabled = true。如果您使用纯 js 来禁用它,上面的函数应该可以很好地重新启用它。例如,如果 ajaxify 属性“Enabled”设置为 true,则将以下 javascript 放入您的页面中:

window.onload = function(){
    document.getElementById("btnSend").disabled = true;
};

然后使用上面编写的函数 onkeyupontextbox() 启用它。因为 javascript 正在禁用该按钮,所以它应该能够重新启用它。之前,您禁用了 Ajaxified 属性并尝试使用 js 重新启用。

Sounds like you're trying to mix Ajaxified properties and DOM element properties.
Leave the property Enabled = "True" when you ajaxify it, then use JS on page load to btnSend.disabled = true it. If you use pure js to disable it the function you have above should work fine to re-enable it. For example, if the ajaxify property 'Enabled' is set to true, then place the following javascript into your page:

window.onload = function(){
    document.getElementById("btnSend").disabled = true;
};

Then use the function you wrote above to enable it onkeyupontextbox(). Because javascript is disabling the button, it should be able to re-enable it. Before, you were disabling with the Ajaxified property and trying to re-enable with js.

薆情海 2024-09-14 06:49:14

以下可以是答案吗? (没有使用 RadAjaxmanager 的经验)

function EnableBtnSend()
 {
    $find("<%=btnSend.ClientID %>").ajaxRequest("");
 }

在这里找到:http://www.telerik。 com/help/aspnet-ajax/grdenabledconventions.html

Could following be the answer? (Dont have experiences with RadAjaxmanager)

function EnableBtnSend()
 {
    $find("<%=btnSend.ClientID %>").ajaxRequest("");
 }

Found here: http://www.telerik.com/help/aspnet-ajax/grdenabledconventions.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文