HTMLInputElement: capture 属性
HTMLInputElement 接口的 capture 属性反映了 <input> 元素的 capture 属性。该属性和属性仅与 <input type="file"> 相关,指定是应从用户面向的(user)还是面向外部的(environment)摄像头或麦克风捕获新文件。文件类型由 accept 属性定义。如果未显式设置该属性,则 capture 属性为空字符串("")。
值
一个字符串;通常为 user 或 environment,或空字符串("")。
示例
js
const inputElement = document.querySelector("avatar");
console.log(inputElement.capture); // the current value of the capture attribute
inputElement.capture = "user"; // sets the capture value
规范
| 规范 |
|---|
| HTML 媒体捕获 # dom-htmlinputelement-capture |
浏览器兼容性
加载中…