StefiIOE

zadaca 1 vtor termin juni ipks

Aug 16th, 2020 (edited)
1,790
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>Title</title>
  6. </head>
  7. <script>
  8.  
  9.     function pomestiLevo() {
  10.         var cifra = document.getElementById('pole').value;
  11.         cifra=cifra.split('');
  12.  
  13.         for(var i =cifra.length ; i >=0 ; --i){
  14.  
  15.             var tmp=cifra[cifra.length-1];
  16.             cifra[cifra.length-1]=cifra[i];
  17.             cifra[i]=tmp;
  18.         }
  19.         for(i = cifra.length ;  i >=1 ; --i){
  20.  
  21.             tmp=cifra[cifra.length-1];
  22.             cifra[cifra.length-1]=cifra[i-1];
  23.             cifra[i-1]=tmp;
  24.         }
  25.         cifra=cifra.join('');
  26.         document.getElementById('pole').value = cifra;
  27.  
  28.     }
  29.  
  30.     function pomestiDesno() {
  31.         var cifra = document.getElementById('pole').value;
  32.         cifra = cifra.split('');
  33.  
  34.         for(var i = 0 ; i < cifra.length ; i ++) {
  35.                 var tmp = cifra[i];
  36.                 cifra[i] = cifra[cifra.length-1];
  37.                 cifra[cifra.length-1] = tmp;
  38.             }
  39.         for( i = 1 ; i < cifra.length ; i ++) {
  40.             tmp = cifra[i-1];
  41.             cifra[i-1] = cifra[cifra.length - 1];
  42.             cifra[cifra.length - 1] = tmp;
  43.         }
  44.  
  45.         cifra=cifra.join('');
  46.         document.getElementById('pole').value=cifra;
  47.     }
  48.  
  49.      function Convert() {
  50.         var cifra = document.getElementById('pole').value;
  51.         cifra=cifra.split('');
  52.  
  53.         for(var i = 0 ; i < cifra.length ; i++){
  54.  
  55.             if(cifra[i]<0){
  56.  
  57.                 cifra[i]+=10;
  58.             }
  59.             else{
  60.             cifra[i]-=2;
  61.             }
  62.  
  63.         }
  64.  
  65.         cifra=cifra.join('');
  66.         document.getElementById('pole').value = cifra;
  67.  
  68.      }
  69.      function Proveri() {
  70.         cifra=document.getElementById('pole').value;
  71.          cifra=cifra.split('');
  72.          var brojach = 0;
  73.          for(var i = 0 ; i < cifra.length ; i ++){
  74.  
  75.              if(cifra[i]%3 ==0){
  76.                  brojach++;
  77.                  }
  78.  
  79.          }
  80.          if(brojach>=3){
  81.              document.write("sovrshen");
  82.          }
  83.  
  84.          cifra=cifra.join('');
  85.          document.getElementById('pole').value=cifra;
  86.  
  87.      }
  88.      function Zacuvaj() {
  89.         var cifra = document.getElementById('pole').value;
  90.         var lista = document.getElementById('lista');
  91.         var li = document.createElement('li');
  92.  
  93.         var text = document.createTextNode(cifra);
  94.         li.appendChild(text);
  95.         lista.appendChild(li);
  96.         document.getElementById('pole').value="";
  97.  
  98.      }
  99. </script>
  100.  
  101. <body>
  102.  
  103. <input type="text" id="pole">
  104. <button onclick="pomestiLevo()"><</button>
  105. <button onclick="pomestiDesno()">></button>
  106. <button onclick="Convert()">CONVERT</button>
  107. <button onclick="Proveri()">CHECK</button>
  108. <button onclick="Zacuvaj()">STORE</button>
  109. <ul id="lista">
  110.  
  111. </ul>
  112.  
  113. </body>
  114. </html>
Add Comment
Please, Sign In to add comment