`
tianjun309
  • 浏览: 358823 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

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 = "";
    }
}
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics