Simplified JavaScript demo code to use textContent instead of manipulating text nodes.
This commit is contained in:
parent
d0945942a9
commit
b5ab7dfb7f
|
@ -127,10 +127,7 @@ function redrawQrCode() {
|
||||||
stats += "encoding mode = " + describeSegments(segs) + ", ";
|
stats += "encoding mode = " + describeSegments(segs) + ", ";
|
||||||
stats += "error correction = level " + "LMQH".charAt(qr.errorCorrectionLevel.ordinal) + ", ";
|
stats += "error correction = level " + "LMQH".charAt(qr.errorCorrectionLevel.ordinal) + ", ";
|
||||||
stats += "data bits = " + qrcodegen.QrSegment.getTotalBits(segs, qr.version) + ".";
|
stats += "data bits = " + qrcodegen.QrSegment.getTotalBits(segs, qr.version) + ".";
|
||||||
var elem = document.getElementById("statistics-output");
|
document.getElementById("statistics-output").textContent = stats;
|
||||||
while (elem.firstChild != null)
|
|
||||||
elem.removeChild(elem.firstChild);
|
|
||||||
elem.appendChild(document.createTextNode(stats));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue