条形码扫描仪重定向到扫描网址
也许这样的事情。
<h3>Barcode</h3>
<textarea class="bcode" name="barcode"></textarea>
<span class="action"></span>
有些JS处理动作
$(function() {
$('.bcode').on('paste',function(){
var _this = this;
setTimeout(function(){
//now do something with the paste data
window.location = "https://www.google.se/search?q=" + _this.value;
},1000);
});
});
这看起来很有希望,但似乎没有在这个例子上工作。它正确扫描,但数据只填写表单,它实际上并没有重定向 – Hunterisabeast
我猜你的表单被填充模仿键盘输入而不是粘贴。因此,您可能需要调整上述代码以绑定到'keyup',并将超时值保存到变量中,以便可以取消任何前面的条目。 – Aran
这样的事情应该做的伎俩: '''$(函数(){ VAR _timer = NULL; $()在( 'KEYUP '函数(){ VAR _this =这个' BCODE。'。 ; if(_timer!== null)clearTimeout(_timer); _timer = setTimeout(function(){ window.location =“https://www.google.se/search?q=”+ _this.value; },500); }); });''' – Aran
代码http://*.com/questions/8465839/integrating-barcode-scanner-into-php - 应用 – waterloomatt