Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Tabele w Javascript (nie działa tak jak bym chciał)
Forum PHP.pl > Forum > Po stronie przeglądarki
wouga
Mam Skrypt który ostatnio pisałem i inne kody modyfikowałem aby osiągnąć chciany efekt.. i osiągnąłem... ale tylko pod mozzilla... możecie mi powiedzieć dlaczego pod IE nie działa a pod Operą dziwnie wygląda?
z góry dzieki

oto kod:
  1. <body onload="start()">
  2. var gUniqueRowID = 0;
  3.  
  4. //-----------------------------------------------------
  5.  
  6. function usuwaj_ajax(theRowID,co)
  7. {
  8. var table = document.getElementById( "users" );
  9. var rowToDelete = document.getElementById( theRowID );
  10. if (confirm("Czy Napewno Chcesz Usunąć tego uzytkownika?"))
  11. {
  12. //table.removeChild( rowToDelete );
  13. //removeRowWithID( theRowID,co);
  14. advAJAX.setDefaultParameters
  15. ({
  16. onInitialization : function(obj)
  17. {
  18. var table = document.getElementById( "users" );
  19. var newRow = document.createElement( "tr" );
  20. table.appendChild( newRow );
  21. gUniqueRowID += 1;
  22. newRow.id = "queryItem" + gUniqueRowID;
  23. var gRowText = "<td colspan=8 align=center bgcolor=#FF0000><h1>Prosze Czekać!</h1></td>";
  24. str = gRowText.replace( /#ROWID#/g, ""+gUniqueRowID );
  25. newRow.innerHTML = str;
  26.  
  27. },
  28. onSuccess : function(obj)
  29. {
  30. var table2 = document.getElementById( "users" );
  31. var rowToDelete2 = document.getElementById("queryItem"+gUniqueRowID);
  32. table2.removeChild( rowToDelete2);
  33. if(obj.responseText==1)
  34. {
  35. table.removeChild( rowToDelete );
  36. }
  37. else if(obj.responseText==0)
  38. {
  39. alert('ERROR! Nie Można Usunąć!');
  40. }
  41. else
  42. {
  43. alert('ERROR! Błędna Komenda!');
  44. }
  45.  
  46. },
  47. onError : function(obj)
  48. {
  49. alert('ERROR! Nie Można Usunąć!');
  50. }
  51. });
  52. advAJAX.get({ url: "cmd.php?&cmd=delete&cmd2=users&id="+co, tag: "dostepnosc" });
  53. advAJAX.setDefaultParameters({});
  54. }
  55. }
  56.  
  57. //-----------------------------------------------------
  58.  
  59. function removeRowWithID( theRowID,co)
  60. {
  61. var table = document.getElementById( "users" );
  62. var rowToDelete = document.getElementById( theRowID );
  63. if (confirm("Czy Napewno Chcesz Usunąć tego uzytkownika?"))
  64. table.removeChild( rowToDelete );
  65. }
  66. //-----------------------------------------------------
  67.  
  68. function start()
  69. {
  70. newRow('1','Nazwisko,'Imie','wouga','#######','szczegoly','Szczegóły');
  71.  
  72. newRow('2','Nazwisko2,'Imie2','wouga2','#######','szczegoly','Szczegóły'); }
  73.  
  74. //-----------------------------------------------------
  75.  
  76. function newRow(id,nazwisko,imie,nick,email,akcja_l,akcja)
  77. {
  78. var table = document.getElementById( "users" );
  79. var newRow = document.createElement( "tr" );
  80. table.appendChild( newRow );
  81. gUniqueRowID += 1;
  82. newRow.id = "queryItem" + gUniqueRowID;
  83. var gRowText = "<td width=24 height=21>"+id+"</td><td width=86 height=21>"+nazwisko+"</td><td width=56 height=21>"+imie+"</td><td width=82 height=21>"+nick+"</td><td width=125 height=21>"+email+"</td><td width=45 height=21><a href=\"?op=konta&cmd=edytuj&id="+id+"\">[Edytuj]</a></td><td width=39 height=21><a href=\"java script:usuwaj_ajax('queryItem#ROWID#','"+id+"');\">[Usuń]</a></td><td width=70 height=21><a href=\"?op=konta&cmd="+akcja_l+"&id="+id+"\">["+akcja+"]</a></td>";
  84. str = gRowText.replace( /#ROWID#/g, ""+gUniqueRowID );
  85. newRow.innerHTML = str;
  86. newRow.setAttribute("onmouseover", "this.style.background='#ababab'");
  87. newRow.setAttribute("onmouseout", "this.style.background=''");
  88. }
  89.  
  90. <table border="0" class="" cellpadding="2" cellspacing="2" style="border-collapse: collapse" bordercolor="#111111" width="544" height="52" id="users">
  91.  
  92. <tr bgcolor="#8b8b8b">
  93. <td width="24" height="21">id</td>
  94. <td width="86" height="21">Nazwisko</td>
  95. <td width="56" height="21">Imię</td>
  96. <td width="82" height="21">Nick</td>
  97. <td width="125" height="21">E-mail</td>
  98.  
  99. <td width="45" height="21">[Edytuj]</td>
  100. <td width="39" height="21">[Usuń]</td>
  101. <td width="70" height="21">[Akcja]</td>
  102. </tr>
  103.  
  104. </table>
stoprocent
Nie wglebilem sie w caly skrypt ale z tego co mi sie wydaje to problem polega na tym ze IE ma ograniczony dostep to innerHTML etc poprzez tag table.
Daj w table jeszce tbody i wtdy odwoluj sie do tbody a nie do table.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.