HTML:
<input name="txtClearAllotDate" type="text" class="txtSmallBorderBGText"
maxlength="10" id="txtClearAllotDate_txtClearAllotDate_EditBox" style="color:SteelBlue;height:18px;width:140px;"/>
JS:
if(objClearAllotMark.value=="N")
{
objClearAllotDate.className="txtSmallBorderBGText";
objClearAllotDate.value="";
objClearAllotDate.disabled=true;
}
else
{
objClearAllotDate.className="txtInputText";
objClearAllotDate.disabled=false;
}
行如上面的代代码,如果我预设txtClearAllotDate 的backgroundColor,再想使用objClearAllotDate.className="txtSmallBorderBGText"去改变它的背景颜色会无效。
我的解决办法是改objClearAllotDate.className="txtSmallBorderBGText"为objClearAllotDate.style.backgroundColor="#DFDFDF",就是直接改变它的backgroundColor。
不知道为什么,请高人指点。