<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<input type="text" />
<input type="text" />
<input type="button" id="btn" value="搜索" />
<script type="text/javascript">
var btn = document.getElementById('btn');
var inps = document.getElementsByTagName('input');
btn.onclick = function(){
for(var i=0;i<inps.length;i++){
inp = inps[i];
if(inp.type === 'text'){ //全等于>>>>很重要
inp.disabled = true;
}
}
}
</script>
</body>
</html>