Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

134
Visualizações
Using zxing Barcode Scanner within a web page and scan multiple barcodes in same page

I'm trying to use the code below to scan multiple barcodes and insert them in the coresponding textboxes. What i want to achieve is to press the scan button in front of the textfield and the scan result to be inserted in the textfield near the scanbutton. Ex of code that i use ( is ok for the first textfield)

<!DOCTYPE html>
<script type="text/javascript">
    function zxinglistener(e){
        localStorage["zxingbarcode"] = "";
        if(e.url.split("\#")[0] == window.location.href){
            window.focus();
            processBarcode(decodeURIComponent(e.newValue));
        }
        window.removeEventListener("storage", zxinglistener, false);
    }
    if(window.location.hash != ""){
        localStorage["zxingbarcode"] = window.location.hash.substr(1);
        self.close();
        window.location.href="about:blank";//In case self.close is disabled
    }else{
        window.addEventListener("hashchange", function(e){
            window.removeEventListener("storage", zxinglistener, false);
            var hash = window.location.hash.substr(1);
            if (hash != "") {
                window.location.hash = "";
                processBarcode(decodeURIComponent(hash));
            }
        }, false);
    }
    function getScan(){
        var href = window.location.href.split("\#")[0];
        window.addEventListener("storage", zxinglistener, false);
        zxingWindow = window.open("zxing://scan/?ret=" + encodeURIComponent(href + "#{CODE}"),'_self');
    }

</script>

<html>
    <head>
        <script type="text/javascript">
             function processBarcode(b){
               document.getElementById("result1").value=b;

       
                 } 
        </script>
    </head>
    <body>
        <button onclick="getScan()">get Scan result1</button>
        <input id="result1"  type="text"></input><br>
        <button onclick="getScan()">get Scan result2</button>
        <input id="result2"  type="text"></input><br>
        <button onclick="getScan()">get Scan result3</button>
        <input id="result3"  type="text"></input><br>

    </body>
</html>
    
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda