javascript禁止表单输入

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<h3>禁止输入</h3>
<input type="text" value="禁止输入" id="disInput">
<script>
    var textinput=document.getElementById("disInput");
    textinput.onfocus=function(){
        this.blur();
    }
</script>
</body>
</html>

你可能感兴趣的:(javascript禁止表单输入)