StefiIOE

lab 3.2

Feb 10th, 2020
166
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPEhtml>
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5.   <meta charset="utf-8"/>
  6.   <title>About Me</title>
  7. </head>
  8. <body>
  9. <h2>Brisi odreden element od niza</h2>
  10. <p>
  11. <div>Vnesi ja nizata</div> <br>
  12. <div><input type="text" id="Array"></div> <br>
  13. <div>Vnesi go elementot sto sakas da go izbrises</div> <br>
  14. <div><input type="text" id="Element"></div> <br>
  15. <div><input type="button" value="Brisi" onclick="remove_array_element(document.getElementById('Array').value, document.getElementById('Element').value)"></div> <br>
  16. </p>
  17. <p id="Answer"></p>
  18. </body>
  19. </html>
  20. <script>
  21. function remove_array_element(x,a)
  22. {
  23.   x=x.split(" ");
  24.   var element = a;
  25.   var z=x.filter(function (x)
  26.   {
  27.     return x!=a;
  28.  
  29.  
  30.   });
  31.   document.getElementById("Answer").innerHTML=z;
  32.   console.log(z);
  33.   return z;
  34.  
  35. }
  36. </script>
RAW Paste Data