Maxdola

Untitled

Dec 31st, 2019
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. var wunschliste= [];
  2. var input;
  3. var arraypointer;
  4.  
  5. //Baut die ganze Liste erneut auf - refreshed diese sozusagen.
  6. var refreshwunschliste = "";
  7.  
  8. for (var i = 0; i < wunschliste.length; i++) {
  9. arraypointer = i;
  10. html += "<tr><td>" + (i + 1) + ". " + wunschliste[i] + "</td></tr>";
  11. html += "<tr><td><input name='altenwunschlöschen'id='" + arraypointer + "'type='button'value='X'onclick='wunschLöschen(wunschinput)'></td></tr>"
  12. }
  13.  
  14.  
  15. function wunschHinzufügen(input) {
  16. inputcounter = wunschliste.length + 1;
  17. wunschliste.push(input.value);
  18. console.log(wunschliste);
  19. document.getElementById("wunschliste").innerHTML += refreshwunschliste;
  20. }
  21.  
  22. function wunschLöschen(wunschinput) {
  23. wunschliste.splice(wunschinput.id, 1); //Entfernt 1 Element an der Index-Stelle des Arrays wunschliste - wohin der arraypointer (die id des jeweiligen Buttons) hinverweist.
  24. document.getElementById("wunschliste").innerHTML += refreshwunschliste;
  25. }
  26.  
  27. window.onload = textloopen();
  28.  
  29. function textloopen() {
  30. var gelooptertext = ["I wish Jan a merry Christmas!", "Santa be partying Christmas!", "Lasse is nowhere to be seen on New Year!"];
  31.  
  32. for(var loop=0;loop<3;loop++) {
  33. console.log(document);
  34. console.log(document.getElementById("looptext"))
  35. document.getElementById("looptext").innerHTML += gelooptertext[loop];
  36. console.log(document.getElementById("looptext"));
  37. setTimeout(() => {}, 3000);
  38. }
  39. loop=0;
  40.  
  41. //if(1 > 0) {
  42. //document.getElementById("looptext").innerHTML += gelooptertext1;
  43. //console.log(document.getElementById("looptext");
  44. //setTimeout((){}, 3000);
  45. //document.getElementById("looptext").innerHTML += gelooptertext2;
  46. //console.log(document.getElementById("looptext");
  47. //setTimeout((){}, 3000);
  48. //document.getElementById("looptext").innerHTML += gelooptertext3;
  49. //console.log(document.getElementById("looptext");
  50. //setTimeout((){}, 3000);
  51. //loop = 0;
  52. //} else {
  53. // loop = 1;
  54. // }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment