无法更改已禁用文本字段的colouor [英] cant change the colouor of the disabled textfield

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

问题描述





我写了一个禁用字段的函数



函数disableField(formName, fieldName){

var field = eval(document.forms [formName]。+ fieldName);

if(field!= null){

field.disabled = true

field.style.backgroundColor =DDE7C7;



}

}



但是文字的颜色是灰色的,默认情况下是IE浏览器。

但我需要将颜色设为黑色,看起来更明显。

请提供任何解决方案。

Hi,

I have writtena function which disabled the fields

function disableField(formName, fieldName) {
var field = eval("document.forms[formName]."+fieldName);
if (field != null) {
field.disabled = true
field.style.backgroundColor = "DDE7C7";

}
}

but the colour of the text is grey, which is by default for IE.
But i need to make the colour as black, to look more visible.
Please provide any solution.

推荐答案

您无法更改浏览器的工作方式。我总是惊讶于人们认为你可以。禁用的文本框看起来颜色相同,因此您可以看到它已禁用。除非在禁用它之前设置颜色,否则它无法正常工作。
You can't change how the browser works. I am always astonished that people think you can. A disabled textbox looks the same color, so you can see it's disabled. Unless it works if you set the color BEFORE disabling it, you can't do it.


这篇关于无法更改已禁用文本字段的colouor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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