JavaScript DOM操作案例点击按钮禁用文本框

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<input type="button" value="禁用文本框" id="bt"/>
<input type="text" value="我是文本框" id="tex"/>
<script>
    document.getElementById("bt").onclick = function () {
      document.getElementById("tex").disabled = "disabled";
    };
</script>
</body>
</html>

 

posted @ 2018-07-22 17:05  {颜逸}  阅读(929)  评论(0编辑  收藏  举报