启用禁用选项 [英] Enabling disabled option

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

问题描述

有人可以帮助我吗?我正在尝试将禁用选项设置为在用户单击链接时启用。我已经尝试了几乎所有东西,我几乎把头发拉了出来。


我想启用的选项是一个测试盒。

Can somebody help me. I''m trying to set a disabled option to enabled when the user click on a link. I''ve tried just about everything and I''m practically pulling my hair out.

The option I want to enable is a test box.

展开 | 选择 | Wrap | 行号

推荐答案

首先,禁用是HTML独立属性。如果你想设置一个值,那么使用" disabled"

document.form.elements 是一个元素集合(但也许甚至可能) document.form 调用已经无效*)因此没有 .disabled 属性。


* - 不使用HTML / CSS / JavaScript关键字作为变量名称是一种很好的编码实践
first, disabled is a HTML standalone attribute. if you want to set a value, then use "disabled".

document.form.elements is an element collection (but maybe even the document.form call is already invalid*) and as such doesn’t have a .disabled property.

* - it is good coding practice to not use HTML/CSS/JavaScript keywords as variable names


我没有调用表格表单。我只是用它代替我的表格名称。


我不确定元素集合的含义。
I''m not calling the form form. I''m just using that in place of my form name.

I''m not sure what you mean by an element collection.


在(例如)调用<时返回的相同内容I> document.getElementsByName()的。 document.form_name.elements 对表单中的所有表单控件执行相同的操作。
the same thing that is returned when (for instance) calling document.getElementsByName(). document.form_name.elements does the same for all form controls in a form.


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

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