input输入框为只读灰色

  • Post author:
  • Post category:其他


<STYLE>

.inputReadOnly{readonly:expression(this.readOnly=true);background-color:expression((this.readOnly && this.readOnly==true)?”#BEBEBE”:””) }

.inputNotReadOnly { readonly: expression(this . readOnly = false);    background-color: expression(( this . readOnly &&   this . readOnly == false)  ? “#FFFFFF” : “” )

}

</STYLE>

<input type=”text” name=”f_EfullName” id=”f_EfullName”

size=”18″ maxlength=”30″ class=”inputReadOnly”/>



动态改变样式

第一种

document.getElementById(“f_empNum”).

className

=”inputNotReadOnly”;

第二种

var style={


//readonly: false,

backgroundColor: “#FFFFFF”

};

function  getElement(_elementID)

{


this._element=document.getElementById(_elementID);

}

function setStyle(divID)//divID元素ID

{


var element =new getElement(divID);

var _element =element._element;

for(var p in  style)

{


_element.style[p]=style[p];

}

var  textStyle=element.style;

}



版权声明:本文为Alinaxz原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。