input设成disabled后样式怎么对文字的颜色不起作用?

请尝试如下代码:

<html>

<head>

<title>disabled设置字体颜色</title>

</head>

<script>

functioninit(){

readOnlySelect(document.getElementById("readOnlyResType"));

}

functionreadOnlySelect(obj){

obj.onfocus=function(){

returnthis.blur();

}

obj.onmouseover=function(){

returnthis.setCapture();

}

obj.onmouseout=function(){

returnthis.releaseCapture();

}

}

functiondocument.onkeydown(){

if(event.keyCode=={alert(document.activeElement.type);

if(document.activeElement.readOnly!=undefined){

if(document.activeElement.type.toLowerCase()=="textarea"||document.activeElement.type.toLowerCase()=="text"){

if(document.activeElement.readOnly==false)

returntrue;

}

}

returnfalse;

}

}

</script>

<bodyonload='init()'>

<inputtype="text"readonlystyle="color:#FF0000"value="红色"/>

<inputtype="text"disabledstyle="color:#FF0000"value="红色"/>

<spanid="readOnlyResType">

<selectstyle="color:#FF0000">

<option>红色</option>

<option>红色</option>

</select>

</body>

</html>