Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript]cellPadding
--pepe--
post
Post #1





Goście







tworze tabelke za pomoca JS jak moge do niej przypisać cellPadding i cellSpacing

  1. <?php
  2. var tabela = document.createElement('TABLE');
  3. tabela.id='tab';
  4. tabela.cellPadding='0';
  5. tabela.cellSpacing='0';
  6.  
  7.    var kontener = document.getElementById('head');
  8.    kontener.appendChild(tabela);
  9. ?>


no bo tak niestety nie dziala
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
drPayton
post
Post #2





Grupa: Zarejestrowani
Postów: 890
Pomógł: 65
Dołączył: 13.11.2005
Skąd: Olsztyn

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


Np tak:
  1. tabela.setAttribute('cellpadding', 0); tabela.setAttribute('cellspacing', 0);


Ogólnie w ten sposób do elementu możesz przypisać dowolny atrybut. Jedno 'ale' - IE nie obsłuży atrybutów będących 'eventami' czyli np onclick
Zapis:
  1. element.setAttribute('onclick', 'alert("Foo")');

Zadziała pod FF, chyba Operą ale już nie pod IE6 (nie wiem jak IE7)

edit: Aczkolwiek:
  1. tabela.cellPadding=0;
  2. tabela.cellSpacing=0;

również powinno działać...

Ten post edytował drPayton 15.10.2008, 12:51:29
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 21.08.2025 - 15:38