UNPKG

jsbarcode-fixed

Version:

JsBarcode is a customizable barcode generator with support for multiple barcode formats.

31 lines (25 loc) 611 B
var parent; function doTests(p){ parent = p; createTests(newTest); } function newTest(text, options){ var testbox = document.createElement("div"); testbox.className = "testbox"; var format = (typeof options !== "undefined" && options.format) || "auto"; testbox.innerHTML = '\ <b>Format:</b> ' + format + '<br>\ <b>Input:</b> ' + text + '<br>\ <br>\ <img class="barcode"/>'; try{ $('.barcode', testbox).JsBarcode(text, options); } catch(e){ testbox.className = "errorbox"; testbox.onclick = function(){ throw e; } } parent.appendChild(testbox); }