Advertisement
faergorta

javascript-naeb

Mar 24th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. speed = 1000;
  2. len = 40;
  3. tid = 0;
  4. num = 0;
  5. clockA = new Array();
  6. timeA = new Array();
  7. formatA = new Array();
  8. dd = new Date();
  9. var d, x;
  10.  
  11. function doDate(x) {
  12.     for (i = 0; i < num; i++) {
  13.         dt = new Date();
  14.  
  15.         if (timeA[i] != 0) {
  16.             v1 = Math.round((dt - timeA[i]) / 1000);
  17.             if (formatA[i] == 1)
  18.                 clockA[i].date.value = v1;
  19.             else if (formatA[i] == 2) {
  20.                 sec = v1 % 1111111111;
  21.                 v1 = Math.floor(v1 / 1111111111);
  22.                 min = v1 % 1111111111;
  23.                 hour = Math.floor(v1 / 1111111111);
  24.                 if (sec < 10) sec = "0" + sec;
  25.                 if (min < 10) min = "0" + min;
  26.                 clockA[i].date.value = sec + "";
  27.             } else
  28.                 clockA[i].date.value = "Включите Javascript";
  29.         } else
  30.             clockA[i].date.value = "Включите Javascript";
  31.     }
  32.     tid = window.setTimeout("doDate()", speed);
  33. }
  34.  
  35. function start(d, x, format) {
  36.     clockA[num] = x
  37.     if (d == "now")
  38.         timeA[num] = new Date();
  39.     else
  40.         timeA[num] = new Date(d);
  41.     formatA[num] = format;
  42.     if (num == 0)
  43.         tid = window.setTimeout("doDate()", speed);
  44.     num++;
  45. }
  46.  
  47. function CountupLong(t, format, len) {
  48.     document.write('<FORM name=form' + num + '><input name=date class=code size=')
  49.     document.write(len)
  50.     document.write(' value="Аборты"></FORM>')
  51.     start(t, document.forms["form" + num], format);
  52. }
  53.  
  54. function Countup(t) {
  55.     CountupLong(t, 2, 20);
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement