Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> appendChild i removeChild nie działa w IE :(
exseerius
post
Post #1





Grupa: Zarejestrowani
Postów: 55
Pomógł: 0
Dołączył: 31.12.2006

Ostrzeżenie: (0%)
-----


Człowiek się męczy, pracuje pisze, sprawdza w FF działa, przechodzi na IE - już nie działa :/

Ktoś mi powie dlaczego ?

Kodzik JS:

  1. var lines = 2;
  2. var maks = 26;
  3. var mini = 6;
  4.  
  5. function AddLine(table){
  6. if (lines == maks) {
  7. alert("Osiągnąłeś maksymalną liczbę dokumentów!\nWygeneruj teraz PDF i przygotuj kolejną checklistę!");
  8. }
  9. else {
  10. var row = document.createElement('tr');
  11. row.setAttribute("id",'dok_'+lines);
  12.  
  13. var cell = document.createElement('td');
  14. var inpt = document.createElement('input');
  15. var cellText = document.createTextNode(lines);
  16.  
  17. cell.appendChild(cellText);
  18. row.appendChild(cell);
  19.  
  20. var cell = document.createElement('td');
  21. var inpt = document.createElement('input');
  22. var cellText = document.createTextNode(lines);
  23.  
  24. inpt.setAttribute("type",'text');
  25. inpt.setAttribute("name","name["+lines+"]");
  26. cell.appendChild(inpt);
  27. row.appendChild(cell);
  28.  
  29. var cell = document.createElement('td');
  30. var inpt = document.createElement('input');
  31. var cellText = document.createTextNode(lines);
  32.  
  33. inpt.setAttribute("type",'text');
  34. inpt.setAttribute("name","doc["+lines+"]");
  35. cell.appendChild(inpt);
  36. row.appendChild(cell);
  37.  
  38. var cell = document.createElement('td');
  39. var inpt = document.createElement('input');
  40. var cellText = document.createTextNode(lines);
  41.  
  42. inpt.setAttribute("type",'text');
  43. inpt.setAttribute("name","uwagi["+lines+"]");
  44. cell.appendChild(inpt);
  45. row.appendChild(cell);
  46.  
  47. document.getElementById(table).appendChild(row);
  48.  
  49. lines++;
  50. }
  51. }
  52.  
  53. function DelLine(table) {
  54. var lp = lines-1;
  55. var tabelka = document.getElementById(table);
  56. var row = document.getElementById('dok_'+lp);
  57. tabelka.removeChild(row);
  58. lines = lp;
  59. alert("DEL: dok_"+lp);
  60. }


i to co w htmlu:

  1. <table id="documents">
  2. <tr>
  3.  
  4. <td>Lp.</td>
  5. <td>Imię i Nazwisko</td>
  6. <td>Typ dokumentu</td>
  7. <td>Uwagi</td>
  8. </tr>
  9.  
  10. <tr>
  11. <td>1</td>
  12.  
  13. <td><input type='text' name='name[1]' value=''></td>
  14. <td><input type='text' name='doc[1]' value=''></td>
  15. <td><input type='text' name='uwagi[1]' value=''></td>
  16. </tr>
  17. </table>
  18.  
  19. <input type="button" onclick="javascript:AddLine('documents');" value="Dodaj">
  20. <input type="button" onclick="javascript:DelLine('documents');" value="Usuń">
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 15.09.2025 - 22:08