Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/455.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript HTML5图像捕获在捕获图像后导航到不同页面_Javascript_Jquery_Html - Fatal编程技术网

Javascript HTML5图像捕获在捕获图像后导航到不同页面

Javascript HTML5图像捕获在捕获图像后导航到不同页面,javascript,jquery,html,Javascript,Jquery,Html,我正在使用HTML5、CSS3、JavaScript、jQuery、jQueryMobile开发移动web应用程序。我用它来捕捉图像。捕获图像后,页面将导航到不同的页面。请针对这个问题提出一些解决方案 编辑 下面是我在onchange事件中使用的代码 $.mobile.hidePageLoadingMsg("loadingNotification"); // var input = document.querySelector("imageCaptureFile"); var i

我正在使用HTML5、CSS3、JavaScript、jQuery、jQueryMobile开发移动web应用程序。我用它来捕捉图像。捕获图像后,页面将导航到不同的页面。请针对这个问题提出一些解决方案

编辑

下面是我在onchange事件中使用的代码

 $.mobile.hidePageLoadingMsg("loadingNotification");
   // var input = document.querySelector("imageCaptureFile");
    var input = document.querySelector('input[type=file]');
    var file = input.files[0];
    if (file == undefined) {
        $.mobile.hidePageLoadingMsg("loadingNotification");
    }
    var reader = new FileReader();
    reader.onload = function (e) {
        var actualImage = e.target.result;
        var canvas = document.getElementById('CanvasImage');
        var ctx = canvas.getContext('2d');
        var image = new Image();
        image.onload = function () {
            var MAX_WIDTH = 700;
            var MAX_HEIGHT = 600;
            var width = image.width;
            var height = image.height;
            if (width > height) {
                if (width > MAX_WIDTH) {
                    height *= MAX_WIDTH / width;
                    width = MAX_WIDTH;
                }
            } else {
                if (height > MAX_HEIGHT) {
                    width *= MAX_HEIGHT / height;
                    height = MAX_HEIGHT;
                }
            }


            canvas.width = 1700;
            canvas.height = 1700;
            ctx.drawImage(image, 0, 0, 1600, 1600);
            // ctx.drawImage(image, 0, 0);
        };
        image.style.width = "100%";
        image.style.height = "100%";
        image.src = actualImage;
        setTimeout(function () {
            var convertedImage = canvas.toDataURL("image/jpeg");
            //var convertedImage = actualImage;
            var count = 0;
            var imageCaptureId = GuidGenerator(); //To generate GUID for custom action

            var $ulActionImage = $('#ulActionImage');
            var liImageCapture = "";
            liImageCapture += "<li id=" + imageCaptureId + "" + count + " >";
            var ActionImageCount = document.getElementsByName("aActionImages");
            var ImageCount = ActionImageCount.length + 1;
            liImageCapture += "<a href='#' id='" + auditId + "" + imageCaptureId + "' type='Show" + imageCaptureId + "'  name='aActionImages' onclick='ShowImages(this.type,this.id)'><h3>Image " + ImageCount + "</h3></a><a href='#' id='" + imageCaptureId + "' type=" + count + " onclick='DeleteActionImage(this.id,this.type)'></a>";
            liImageCapture += "</li>";
            $ulActionImage.append(liImageCapture);
            $ulActionImage.listview('refresh');
            $.mobile.hidePageLoadingMsg("loadingNotification");
        }, 1000);
    };
    reader.readAsDataURL(file);

请发布您的代码…$'input[name=imageCaptureFile]'{在这个事件处理程序中,我调用了上面的源代码。这是一个问题吗?这个问题发生在三星GT-19082 Android版本4.2.2中。对于这个问题,有没有解决方案,或者这是一个错误?没有看到任何可能产生这个问题的东西,顺便说一句,也没有看到convertedImage做了任何事情。