https://www.w3schools.com/code/tryit.asp?filename=GBCX38ZTHM0D
(01)112233445566778(11)
<script>
function Slice(){
var UserString = document.getElementById("barkod").value;
var UserStringValue = UserString.length;
var Result = UserString.slice(15,19);
if (UserStringValue > 6){
document.getElementById("barkod").value = Result;
}
else{
console.log("x.");
}
}
</script>
<script>
function clickButton() {
document.getElementById("myCheck").click();
}
</script>