Search This Blog

Sunday, August 4, 2019

Check Digit eAN13

<html>
<body>

<h2>JavaScript Class</h2>

<p>Check Digit eAN13</p>
<input type="text" id="eAN13" onchange="eanCheckDigit(this.value);">
<p id="demo"></p>

<script>
function eanCheckDigit(s){
    var result = 0;
    for (counter = s.length-1; counter >=0; counter--){
        result = result + parseInt(s.charAt(counter)) * (1+(2*(counter % 2)));
    }
    document.getElementById("demo").innerHTML = (10 - (result % 10)) % 10;

}
</script>

</body>
</html>

// Credit goes to FAHIM JAMAL VAI

No comments:

Post a Comment

Restrict File Upload by File Type in Oracle Apex

If you want to restrict file upload by file type/extension/format you can follow the below steps.  Goto File Browser Item --> Advanced --...