Friday, 4 March 2011

Random Minute Generator

Had a need to turk some numbers for putting into a DATETIME field in MySQL so came up with this little script for generating a set of minutes:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
<html xmlns="" lang="en" xml:lang="en">
    <title>Random Minute Generator</title>
    <script type="text/javascript">
      window.onload = function addNumbers(){
        for(var x = 0; x < 217; x++){
          if (document.createTextNode){
            var myNumber = Math.floor(Math.random()*60) + 1;
            if(myNumber < 10){
              myNumber = "0"+myNumber;
            var myText=document.createTextNode(myNumber);
          var newLine=document.createElement('br');
    <div id="myDiv">

Do enjoy if you use it and perhaps leave a comment...?

No comments:

Post a Comment