<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML5页面如何在手机端浏览器调用相机、相册功能</title>
</head>
<body>
<div>
<input type="file" accept="image/*" capture="camera">
<input type="file" accept="video/*" capture="camcorder">
<input type="file" accept="audio/*" capture="microphone">
</div>
</body>
</html>
accept表示打开的系统文件目录; capture表示的是系统所捕获的默认设备,camera:照相机;camcorder:摄像机;microphone:照相+摄像。
如果不加上capture,则只会显示相应的,例如上述三种依次是:拍照或图库,录像或图库,录像或拍照或图库,加上capture之后不会调用图库。
其中还有一个属性multiple,支持多选,当支持多选时,就需要可以选择图库功能,则不需要加capture,
所以只用写成:<input type="file" accept="image/*" multiple>就可以,可以在手机上测试一下。