<script> var randomInt = function(lowerValue, upperValue) { var choices = upperValue - lowerValue + 1; return Math.floor(Math.random() * choices + lowerValue); } var dateTimeMs = function(dt){ try { var t = dt.getFullYear(); } catch(ex) { dt = new Date(); } var mon = dt.getMonth()+1; mon = mon < 10 ? "0"+mon : ""+mon; var dd = dt.getDate(); dd = dd < 10 ? "0"+dd : ""+dd; var hh = dt.getHours(); hh = hh < 10 ? "0"+hh : ""+hh; var mm = dt.getMinutes(); mm = mm < 10 ? "0"+mm : ""+mm; var ss = dt.getSeconds(); ss = ss < 10 ? "0"+ss : ""+ss; var ms = dt.getMilliseconds(); if (ms < 10) ms = "00"+ms; else if (ms < 100) ms = "0"+ms; return dt.getFullYear()+mon+dd+hh+mm+ss+ms; } var timeSeq32 = function(){ return dateTimeMs() + randomInt(100000000000000, 999999999999999); } document.write(timeSeq32()); </script>結果:
20160311155523536304024162436581
沒有留言:
張貼留言