日期:2014-05-16  浏览次数:20342 次

javascript 修改disabled值
错误的如下:
function showCardNum(index)
		{
			var cardOrderDt=document.getElementById("cardOrderDt_"+index);
			if(cardOrderDt.disabled=="disabled")
			{
				cardOrderDt.disabled="";
			}
			else
			{
				cardOrderDt.disabled="disabled";
			}
		}



正确的如下
function showCardNum(index)
		{
			var cardOrderDt=document.getElementById("cardOrderDt_"+index);
			if(cardOrderDt.disabled==true)
			{
				cardOrderDt.disabled=false;
			}
			else
			{
				cardOrderDt.disabled=true;
			}
		}





虽然在html表单域上,是以disabled="disabled"的形式,但是要用javascript改变它们的话,不再是字符串了,而是布尔值。即disabled=true或false