本文转载于:猿2048网站手机网页调用相机拍照或者图库php
<!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:照相+摄像。html
若是不加上capture,则只会显示相应的,例如上述三种依次是:拍照或图库,录像或图库,录像或拍照或图库,加上capture以后不会调用图库。浏览器
其中还有一个属性multiple,支持多选,当支持多选时,就须要能够选择图库功能,则不须要加capture,ide
因此只用写成:<input type="file" accept="image/*" multiple>就能够,能够在手机上测试一下。测试
参考连接:http://blog.csdn.net/zhihua_w/article/details/78125622网站