DIV:
<section id="code">
<a act="radom"></a><a act="clear"></a>
</section>
JS:
$("section#code").on("click", "[act=radom],[act=clear]", function () {
var qrcode;
if ($(this).attr("act") === "clear") {
HD_Form.qrcode.value = "";
$("#divqrcode").html('');
} else {
HD_Form.qrcode.value = new Date().valueOf();
$.getScript("/SysThemes/js/qrcode.min.js", function () {
$("#divqrcode").html('');
qrcode = new QRCode(document.getElementById("divqrcode"), {
width: 100,
height: 100
});
var qrvalue = HD_Form.qrcode.value;
if (qrvalue === "") {
return;
} else {
qrcode.makeCode(qrvalue);
}
})
}
}); |