FileUpload disabled 属性

实例
禁用 FileUpload 按钮:
<form> 获取图片:<input type="file" id="imgfile"> </form> <p>单击下面按钮禁用上面的选择文件按钮。</p> <button onclick="disableElement()">禁用FileUpload</button> <script> function disableElement() { document.getElementById("imgfile").disabled = true; } </script>
定义和用法
disabled 属性可以设置或者返回文件上传按钮是否可用。
被禁用的 input 元素既不可用,也不可点击。可以设置 disabled 属性,直到满足某些其他的条件为止(比如选择了一个复选框等等)。然后,就需要通过 JavaScript 来删除 disabled 值,将 input 元素的值切换为可用。
语法
设置 disabled 属性:
element.disabled = true | false
返回 disabled 属性:
element.disabled
浏览器支持
所有主要浏览器都支持 disabled 属性
