Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> kolorowanie komórek w tabeli
Szakal
post 15.08.2006, 14:12:27
Post #1





Grupa: Zarejestrowani
Postów: 86
Pomógł: 0
Dołączył: 27.05.2004
Skąd: Zielona Góra

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


Witam... mam jakomś tam tabelkę... przykłądowo...

  1. <tr><td OnMouseOn="?" OnMouseOver="?">Komórka 1</td></tr>
  2. <tr><td>Komórka 2</td></tr>
  3. <tr><td>Komórka 3</td></tr>
  4. <tr><td>Komórka 4</td></tr>
  5. <tr><td>Komórka 5</td></tr>


ichodzi mi o to, żeby poszczegulne komórki zmieniały tło po najechaniu na nie kursorem mychy... jak to rozegraćod strony Java script questionmark.gif?


--------------------
Pozdrawiam
(o) Igor Dirbach
Go to the top of the page
+Quote Post
Lonas
post 15.08.2006, 14:16:11
Post #2





Grupa: Zarejestrowani
Postów: 576
Pomógł: 14
Dołączył: 9.11.2005

Ostrzeżenie: (20%)
X----


A nie możesz do tego użyć styli css ?


--------------------
Go to the top of the page
+Quote Post
Cysiaczek
post 15.08.2006, 14:18:07
Post #3





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




Np. najabardziej prymitywnie można tak:
  1. function colorMe(id, kolor){
  2. document.getElementById(id).style.background=kolor;
  3. }
  4.  
  5. <td id="jakies_id" onmouseover='colorMe(this.id, "red")' onmouseout='colorMe(this.id, "pink")'>


Ten post edytował Cysiaczek 15.08.2006, 14:18:54


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
Go to the top of the page
+Quote Post
Szakal
post 15.08.2006, 14:28:22
Post #4





Grupa: Zarejestrowani
Postów: 86
Pomógł: 0
Dołączył: 27.05.2004
Skąd: Zielona Góra

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


Cytat(L.Pociask @ 15.08.2006, 14:16 ) *
A nie możesz do tego użyć styli css ?


no mogę... ale jakaś prpopzycja questionmark.gif chciałbym zrobić coś w stylu pola select... dlatego niepotrzebny mi jest żaden css niewiem tylko jak ustawić zapomocom JavaScript tło danej komórki...

Cytat(Cysiaczek @ 15.08.2006, 14:18 ) *
Np. najabardziej prymitywnie można tak:
  1. function colorMe(id, kolor){
  2. document.getElementById(id).style.background=kolor;
  3. }
  4.  
  5. <td id="jakies_id" onmouseover='colorMe(this.id, "red")' onmouseout='colorMe(this.id, "pink")'>


no robiłem już tak... Zwraca mi "Obiekt nie obsługuje tej wartości lub metody"...


--------------------
Pozdrawiam
(o) Igor Dirbach
Go to the top of the page
+Quote Post
macza
post 15.08.2006, 14:33:35
Post #5





Grupa: Zarejestrowani
Postów: 236
Pomógł: 4
Dołączył: 1.05.2006
Skąd: Lublin

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


ja zrobilem to tak:
java:
  1. function op(aa){
  2. document.getElementById( aa ).style.background='#333333';
  3. }
  4. function up(aa){
  5. document.getElementById( aa ).style.background='none';
  6. }

i teraz dajesz:
<td id=kozak onMouseOver="op(kozak)" onMouseOut="up(kozak)">jhadjgdjug</td>
i dziala


--------------------
_tworzenie stron www tanio Lublin - tworzenie stron www, tanio, szybko, solidnie, własny CMS.
Go to the top of the page
+Quote Post
Szakal
post 15.08.2006, 14:33:40
Post #6





Grupa: Zarejestrowani
Postów: 86
Pomógł: 0
Dołączył: 27.05.2004
Skąd: Zielona Góra

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


  1. <META http-equiv=Content-Type content="text/html; charset=utf-8"></HEAD>
  2. <BODY>
  3. <table cellspacing=1 cellpadding=1 width=300 border=1 id=tbl>
  4. <tr>
  5. <td id=td1><font face=System>Times New Roman</font></td></tr>
  6. <tr>
  7. <td><font face=System>Arial</font></td></tr>
  8. <tr>
  9. <td><font face=System>Arial Black</font></td></tr>
  10. <tr>
  11. <td><font face=System>Arial Narrow</font></td></tr>
  12. <tr>
  13. <td><font face=System>Verdana</font></td></tr></table>
  14. <script language="javascript">
  15. function col(){
  16. document.GetElementById('td1').style.background='red';
  17. }
  18.  
  19. <INPUT type="button" value="Button" onclick="col()">
  20. </BODY></HTML>


mam taki kod...


--------------------
Pozdrawiam
(o) Igor Dirbach
Go to the top of the page
+Quote Post
Cysiaczek
post 15.08.2006, 14:34:49
Post #7





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




Pod IE nie działa?
Bo pod FF działa na 200% - właśnie sprawdziłem. Niestety nie moge teraz sprawdzić na IE, bo nie mam.

BTW - nie GetElementById, a getElementById
JS jest case sensitive.

Pozdrawiam

Ten post edytował Cysiaczek 15.08.2006, 14:37:25


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
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 Wersja Lo-Fi Aktualny czas: 8.07.2025 - 06:48