jhylands

random stock

Mar 5th, 2015
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.69 KB | None | 0 0
  1. <script>
  2.  function secondsToTime(secs){
  3.     var hours = Math.floor(secs / (60 * 60));
  4.     var divisor_for_minutes = secs % (60 * 60);
  5.     var minutes = Math.floor(divisor_for_minutes / 60);
  6.     var divisor_for_seconds = divisor_for_minutes % 60;
  7.     var seconds = Math.ceil(divisor_for_seconds);
  8.     return minutes + ":" + seconds;
  9. }
  10. function makeposition(){
  11. if(Math.random()>0.5){
  12. document.getElementById('type').innerHTML="BUY:USD/GBP";
  13. }else{
  14. document.getElementById('type').innerHTML="SHORT:USD/GBP";
  15. }
  16. document.getElementById('time').innerHTML=secondsToTime(Math.random()*3600);
  17. }
  18.  
  19. </script>
  20. <input type="button" value="Generate" onclick="makeposition()"/>
  21. <li id="type"></li>
  22. <li id="time"></li>
Advertisement
Add Comment
Please, Sign In to add comment