在javascript中的onblur [英] onblur in javascript

查看:92
本文介绍了在javascript中的onblur的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的页面中有一个下拉列表和两个单选按钮。当我从下拉列表中选择未授权时,两个无线电按钮将被禁用。

如何执行此操作。如果javascript需要使用那么步骤是什么。

in my page one dropdown and two radio button. when i select ''unauthorized'' from dropdown,two radio buttton will be disable.
how to do this.if javascript is need to use then what is the step.

推荐答案

1。将onblur或onfocusout附加到下拉列表。

2.当事件发生时,将为此定义的JavaScript方法被提出

3.在这种情况下,检查下拉列表的选定值

4.如果所选值为未授权,则找到两个单选按钮并禁用它们



试用!
1. Attach onblur or onfocusout to the dropdown.
2. When the event occurs, JavaScript method defined for the same will be raised
3. In this event, check the selected value of the dropdown
4. If the selected value is ''unauthorized'' then find the two radio buttons and disable them

Try out!

嗨亲爱的



请试试这个



Hi Dear

please try this

function DisableRadioButton() {
            var e = document.getElementById('<%=DropDownList1.ClientID %>');
            var strUser = e.options[e.selectedIndex].text;
            if (strUser == "unauthorized") {
                document.getElementById('<%=RadioButton1.ClientID %>').disabled = true;
                document.getElementById('<%=RadioButton2.ClientID %>').disabled = true;
            }
        }





在html中添加此行onChange =DisableRadioButton();



add this line in html onChange="DisableRadioButton();"


这篇关于在javascript中的onblur的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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