![](/img/trans.png)
[英]Validation error: Attribute onfocusout not allowed on element input at this point
[英]Attribute capture not allowed on element input at this point
这行代码:
<input name="img" type="file" accept="image/*" capture="camera" onchange="uploadImage(this, 75)" />
未能通过W3C HTML5 验证器检查:
这是验证器中的一个错误。
到目前为止,即使capture
属性还没有进入HTML 规范,它也已经具有“W3C 推荐”状态 ( HTML Media Capture )。 因此,它应该已包含在验证器中。
2018 年 3 月, W3C 邮件列表中提出了一个问题,验证者团队的一名成员承认了这一点。 它已于2020年3 月 21 日修复。
如果您想了解有关 HTML Media Capture 的正确语法的更多信息,请查看这篇文章。
label.cameraButton { display: inline-block; margin: 1em 0; /* Styles to make it look like a button */ padding: 0.5em; border: 2px solid #666; border-color: #EEE #CCC #CCC #EEE; background-color: #DDD; } /* Look like a clicked/depressed button */ label.cameraButton:active { border-color: #CCC #EEE #EEE #CCC; } /* This is the part that actually hides the 'Choose file' text box for camera inputs */ label.cameraButton input[accept*="camera"] { display: none; }
<!DOCTYPE html> <html> <body> <label class="cameraButton">📷 <input type="file" accept="image/*;capture=camera"> </label> </body> </html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.