Currently, I have 4 digit numbers showing randomly if I refresh the page. I tryna add the years infront of the 4 digit numbers but only 4 digit numbers still showing. Is there anyway to show the years in front of random numbers? (Example, 20221234).
<label class="control-label col-sm-4" for="refno">REF nos :</label>
<div class="col-sm-4">
<script type="text/javascript">
now = new Date();
randomNum = '';
randomNum += Math.round(Math.random() * 9);
randomNum += Math.round(Math.random() * 9);
randomNum += now.getTime().toString().slice(-2);
window.onload = function () {
document.getElementById("refno").value = randomNum;
}
document.getElementById("refno").innerHTML = new Date().getFullYear();
</script>
<p class="form-control-static" style="margin-top: -6px;">
<input type="text" class="form-control" id="refno" name="refno" value="<?php echo $refno; ?>" disabled>
</p>
</div>
<div class="col-sm-10"></div>