当前位置: 代码迷 >> Web前端 >> input text 放灰例子
  详细解决方案

input text 放灰例子

热度:445   发布时间:2012-11-09 10:18:47.0
input text 置灰例子
			<form name="testform">
				<select   name= "select1"   onclick= "changeState(); ">
				<option   value=1 selected="selected"> one </option>
				<option   value=2> Two </option>
				</select> 
				<input   type= "text"  id= "one"   name= "input1"   class= "input">
				<input   type= "text"   id= "two"   name= "input2"   class= "input"> 
			</form>

?

.cantinput{background-color:#aaaaaa;}

?

?

function changeState(){
    if (testform.select1.value == 1) {
        testform.input1.className="";
		testform.input1.disabled = "";
        testform.input2.className = "cantinput";
		testform.input2.disabled = "true";
    }
    else {
        testform.input1.className = "cantinput";
		testform.input1.disabled = "true";
        testform.input2.className = "";
		testform.input2.disabled = "";
    }
}
?
  相关解决方案