js中select标签中选中一个选项之后触发事件

<!DOCTYPE html>
<html>
<body>

<h1>My First Web Page</h1>

<p id="demo">My First Paragraph.</p>

<script>
document.getElementById("demo").innerHTML="My1 First JavaScript";
</script>
<se>
<script type="text/javascript">
function checkLawyerType() {
                var lawyerType1 = document.getElementById("lawyerType").innerHTML;
		var lawyerType = document.getElementById("lawyerType").value;
			
			var account = document.getElementById("account")
                        alert(lawyerType1);
			if(lawyerType=="1"){
				account.readOnly = false ;
			}else{
				account.readOnly =true ;
			}
			
		};
</script>

<select id="lawyerType" htmlEscape="false" maxlength="30"  minlength="1"  class="form-control required" onchange = "checkLawyerType();">
  <option value ="0"></option>
  <option value ="1">执行</option>
  <option value="2">仲裁</option>
</select>
<input name ="account" id ="account" readOnly="true">
</body>
</html>

猜你喜欢

转载自blog.csdn.net/yaoyaowudi123/article/details/80040692