Here is the sample script to generate random order number and pass to html element:
<script>
function randomOrder(length, chars)
{
var string = '';
for (var i=length; i > 0; --i)
string += chars[Math.round(Math.random() * (chars.length - 1))];
return string;
} var orderNum = randomOrder(7, '0123456789');
{
var string = '';
for (var i=length; i > 0; --i)
string += chars[Math.round(Math.random() * (chars.length - 1))];
return string;
} var orderNum = randomOrder(7, '0123456789');
document.getElementById("order_num").innerHTML = "ORDER #GMO" +orderNum;
</script>
</script>
No comments:
Post a Comment