display random number after form submission? - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Submit

Description

display random number after form submission?

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <form> 
         <input type="submit" id="ref" name="submit" value="submit"> 
      </form>  
      <script>
    var stampmonths = new Array(   "01","02","03","04","05","06","07","08","09","10","11","12");
    var rnd = Math.floor((Math.random() * 9) + 1);;
    var thedate = new Date();/*from   ww  w .ja v  a  2 s. com*/
    document.getElementById('ref').value = rnd.toString() + stampmonths[thedate.getMonth()] + thedate.getDate() + thedate.getFullYear() +   thedate.getSeconds();
    
      </script> 
   </body>
</html>

Related Tutorials