本示例提示条码扫描,然后将值放入“扫描输入”框中。这适用于一个输入/一个按钮。我的问题是我希望能够添加多个输入/按钮,并进行扫描然后将值放在相应的输入文本框中。<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>Scandit Web SDK</title> <link rel="stylesheet" href="style.css"> <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0'/> <!-- Add the library, as explained on http://docs.scandit.com/stable/web/index.html --> <script src="https://cdn.jsdelivr.net/npm/scandit-sdk@4.x"></script></head><body onclick="console.log('body clicked')"> <div id="scandit-barcode-picker"></div> <div id="input-container"> <input id="scan-input" type="text" placeholder="Scan Receiver..."> <button id="scan" onclick="scan()">SCAN </button> </div> <script> function scan() { startScanning(); } function showScanner() { scannerContainer.style.opacity = "1"; scannerContainer.style.zIndex = "1"; } function hideScanner() { scannerContainer.style.opacity = "0"; scannerContainer.style.zIndex = "-1"; } function startScanning() { showScanner(); if (picker) { picker.resumeScanning(); } } function stopScanning() { hideScanner(); if (picker) { picker.pauseScanning(); } }
添加回答
举报
0/150
提交
取消