以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]如何将上述代码,改为直接调用摄像头?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=136660)

--  作者:YOU
--  发布时间:2019/6/18 16:06:00
--  [求助]如何将上述代码,改为直接调用摄像头?
            With wb.AddInputGroup("form1","ipg3","")
                With .AddUploader("up1","",True) \'True表示允许上传多个文件
                    .AllowDelete = True \'允许删除
                    .Incremental = True \'允许重复选择文件或连续拍照
                End With
            End With

   wb.appendHTML("<script>upyanzsf0.setAttribute(\'capture\',\'camera\');upyanzsf.setAttribute(\'accept\',\'image/*\');</script>")

在页面里使用上述内容,Uploader没有调用摄像头,而是进入了相册

如何将上述代码,改为直接调用摄像头?

--  作者:有点甜
--  发布时间:2019/6/18 16:10:00
--  

 

没办法的,浏览器不支持就没办法。

 

 


--  作者:YOU
--  发布时间:2019/6/18 16:13:00
--  
http://res.wx.qq.com/open/js/jweixin-1.4.0.js  

调用jsJDK 也用不了

--  作者:有点甜
--  发布时间:2019/6/18 17:12:00
--  
以下是引用YOU在2019/6/18 16:13:00的发言:
http://res.wx.qq.com/open/js/jweixin-1.4.0.js  

调用jsJDK 也用不了

 

参考代码

 

alert(1);

wx.ready(function () {
    document.getElementById(\'hym\').onclick = function () {
        wx.chooseImage({
            count: 1, // 默认9
    sizeType: [\'original\', \'compressed\'], // 可以指定是原图还是压缩图,默认二者都有
    sourceType: [\'album\', \'camera\'], // 可以指定来源是相册还是相机,默认二者都有
            success: function (res) {
              alert(2);
              alert(res.localIds);
              document.getElementById(\'test\').src = res.localIds;
            }
        });
    };
    alert(3);
});
wx.error(function (res) {
    alert(res.errMsg);
});

 


--  作者:YOU
--  发布时间:2019/6/18 17:36:00
--  
还是报错
Uncaught TypeError: Cannot set property \'onclick\' of null
(anonymous function) @ pipi.js:4
L.complete @ jweixin-1.4.0.js:1
c @ jweixin-1.4.0.js:1
(anonymous function) @ jweixin-1.4.0.js:1
s @ jweixindebug.js:1t @ jweixindebug.js:1
(anonymous function) @ jweixindebug.js:1
jweixindebug.js:1 
Object {preVerifyJSAPI: Object, updateAppMessageShareData: Object, updateTimelineShareData: Object}

--  作者:有点甜
--  发布时间:2019/6/18 18:34:00
--  

红色的网页元素,请加上,一个按钮,一个文本框

 

alert(1);

wx.ready(function () {
    document.getElementById(\'hym\').onclick = function () {
        wx.chooseImage({
            count: 1, // 默认9
    sizeType: [\'original\', \'compressed\'], // 可以指定是原图还是压缩图,默认二者都有
    sourceType: [\'album\', \'camera\'], // 可以指定来源是相册还是相机,默认二者都有
            success: function (res) {
              alert(2);
              alert(res.localIds);
              document.getElementById(\'test\').src = res.localIds;
            }
        });
    };
    alert(3);
});
wx.error(function (res) {
    alert(res.errMsg);
});

 


--  作者:YOU
--  发布时间:2019/6/19 8:37:00
--  
点击按钮拍照出现一次相册,拍完照以后又出现一次相册,这个怎么处理?
--  作者:有点甜
--  发布时间:2019/6/19 9:41:00
--  
以下是引用YOU在2019/6/19 8:37:00的发言:
点击按钮拍照出现一次相册,拍完照以后又出现一次相册,这个怎么处理?

 

请贴出完整的测试代码。


--  作者:YOU
--  发布时间:2019/6/19 10:20:00
--  
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:调用相机.txt


--  作者:YOU
--  发布时间:2019/6/19 10:20:00
--  
帮忙看看


[此贴子已经被作者于2019/6/19 10:20:38编辑过]