Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [JS] Tabelka z Hooverami - pomozcie lamerowi :)
Yacho
post
Post #1





Grupa: Zarejestrowani
Postów: 148
Pomógł: 0
Dołączył: 16.06.2003

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


Wiec tak - zaznaczam ze w temacie JS jestem ciemny jak..... nie wiem co smile.gif Wiec wybaczcie ze nie przedstyawiam juz jakiegos kodu a tylko to co chcialbym osiagnac
Chodzi mi o takie cus :

Kod
+--------+---------+

|komorka1|komorka2|

|komorka3|komorka4|

+--------+---------+



Wiec tak - komorki w kolumnie 1szej maja bgcolor powiedzmy $a
komorki w drugiej $b
i teraaz chce zeby po najechaniu myszka na konkretny RZĄD
bgcolor komorki w kolumnie 1 zmienial sie na $c a w kolumnie 2 na $d

Wiem ze proszac o takie cos jestem troche jak darmozjad ale naprawde pilna sprawa a z JS jestem noga :/

Dziekuje wszystkim za pomoc


--------------------
-=Yacho=-

nospor -> trzymaj sie i nie dajcie sie !
Go to the top of the page
+Quote Post
Zajec
post
Post #2





Grupa: Zarejestrowani
Postów: 1 086
Pomógł: 8
Dołączył: 10.12.2003

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


Szukanie nie boli
Zamiast this.style uzyj ID.
Go to the top of the page
+Quote Post
Paul
post
Post #3





Grupa: Zarejestrowani
Postów: 636
Pomógł: 0
Dołączył: 22.10.2003
Skąd: Katowice

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


Napisalem takie cos (testowalem z pomyslnym skutkiem na IE, Mozilli i Operze):
[xml:1:414c674fd3]<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-2">
<script type="text/javascript">
<!--
function zmien_kolor(komorki, kolory){
komorki = komorki.split(',');
kolory = kolory.split(',');
for(i=0; i < komorki.length; i++){
document.getElementById('komorka'+komorki[i]).style.backgroundColor = kolory[i];
}
}
// -->
</script>
</head>
<body>
<table width="500" cellspacing="0" cellpadding="0">
<tr onmouseover="zmien_kolor('1,2','#3BB200,#5AD680');" onmouseout="zmien_kolor('1,2','#339900,#33CC66');"><td bgcolor="#339900" id="komorka1">komorka1</td><td bgcolor="#33CC66" id="komorka2">komorka2</td></tr>
<tr onmouseover="zmien_kolor('3,4','#3BB200,#5AD680');" onmouseout="zmien_kolor('3,4','#339900,#33CC66');"><td bgcolor="#339900" id="komorka3">komorka3</td><td id="komorka4" bgcolor="#33CC66">komorka4</td></tr>
</table>
</body></html> [/xml:1:414c674fd3]
Go to the top of the page
+Quote Post
Yacho
post
Post #4





Grupa: Zarejestrowani
Postów: 148
Pomógł: 0
Dołączył: 16.06.2003

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


Super dziekuje wam obu smile.gif
JEszcze jedno male lamowate pytanko smile.gif

Jesli chce wywolac po kliknieciu na komorke jakis url to powinienem uzyc :

[xml:1:4ee649e9f5]onClick="tu cos dalej"[/xml:1:4ee649e9f5]

moze ktos podpowiedziec co ? smile.gif wiem ze to juz maly problem ale tak bede miec wszystko w 1 watku smile.gif


--------------------
-=Yacho=-

nospor -> trzymaj sie i nie dajcie sie !
Go to the top of the page
+Quote Post
Paul
post
Post #5





Grupa: Zarejestrowani
Postów: 636
Pomógł: 0
Dołączył: 22.10.2003
Skąd: Katowice

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


to otworzy w bierzacej ramce / oknie dany adres:
[xml:1:8f8ed075dd]<td onclick="window.location = 'http://www.onet.pl';" style="cursor:pointer;">[/xml:1:8f8ed075dd]
Go to the top of the page
+Quote Post
Yacho
post
Post #6





Grupa: Zarejestrowani
Postów: 148
Pomógł: 0
Dołączył: 16.06.2003

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


[xml:1:5cb9f5c3b9]<html>
<script type="text/javascript">
<!--
function zmien_kolor(komorki, kolory){
komorki = komorki.split(',');
kolory = kolory.split(',');
for(i=0; i < komorki.length; i++){
document.getElementById('komorka'+komorki[i]).style.backgroundColor = kolory[i];
}
}
// -->
</script>
[/xml:1:5cb9f5c3b9][/quote]

Niestety - ten kod wywala sie na tym bloku z bledem - oczekiwano obiektu.... plz help :/


--------------------
-=Yacho=-

nospor -> trzymaj sie i nie dajcie sie !
Go to the top of the page
+Quote Post
Paul
post
Post #7





Grupa: Zarejestrowani
Postów: 636
Pomógł: 0
Dołączył: 22.10.2003
Skąd: Katowice

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


Na jakiej przegladarce ci sie tak dzieje (takiej jak masz w userAgencie :?: ) ? Bo jeszcze raz przetestowalem na IE 6.0, Mozilli 1.6 i Operze 7.23 i jakos dziala....

Jak co taki blad moze sie dzialc jak zrobic takie cos - zostawisz na koncu przecinek:
[quote]zmien_kolor('1,2[b],
Go to the top of the page
+Quote Post
Yacho
post
Post #8





Grupa: Zarejestrowani
Postów: 148
Pomógł: 0
Dołączył: 16.06.2003

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


sprawdzalem na IE6 - operze

a kod wyglada tak :

(cala strona)
[xml:1:a81b00eb9a]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />


<link rel="stylesheet" href="../css/main.css" type="text/css" />

<script type="text/javascript">
<!--
function zmien_kolor(komorki, kolory){
komorki = komorki.split(', ');
kolory = kolory.split(', ');
for(i=0; i < komorki.length; i++){
document.getElementById('komorka'+komorki[i]).style.backgroundColor =
kolory[i];
}
}
// -->
</script>
</head>

<body>
<center>
<TABLE id="container01">
<TR>
<TD>
<TABLE id="container_main1">
<TR>
<!-- komorka od logo -->
<TD id="td_logo"><IMG SRC="../images/logo_small.png" /></TD>
<!-- komorka z topem -->
<TD>TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP TOP </TD>
</TR>
<TR>
<!-- komorka z menu -->
<TD id="td_menu">
<TABLE id="menu_table">
<tr onmouseover="zmien_kolor('home_menu, fake1', '#E69303, #FFFFFF');" onmouseout="zmien_kolor('home_menu, fake1', '#935905, #FFFFFF');" >
<TD id="fake1"></TD>
<TD id="home_menu">Strona główna</TD>
</TR>
<TR>
<TD id="fake2"></TD>
<TD id="ofirmie_menu">O Firmie</TD>
</TR>
<TR>
<TD id="fake3"></TD>
<TD id="galeria_menu">Galeria Produktów</TD>
</TR>
<TR>
<TD id="fake4"></TD>
<TD id="nowosci_menu">Nowe Produkty</TD>
</TR>
<TR>
<TD id="fake5"></TD>
<TD id="kontakt_menu">Kontakt</TD>
</TR>
</TABLE>



</TD>
<!-- a tu mamy tresc -->
<TD>TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC TRESC</TD>
</TR>
</TABLE>

</TD>
</TR>
</TABLE>
</center>
</body>
</html>
[/xml:1:a81b00eb9a]

nie wiem dlaczego nie chodzi :/


--------------------
-=Yacho=-

nospor -> trzymaj sie i nie dajcie sie !
Go to the top of the page
+Quote Post
Paul
post
Post #9





Grupa: Zarejestrowani
Postów: 636
Pomógł: 0
Dołączył: 22.10.2003
Skąd: Katowice

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


zmien to:
Kod
document.getElementById('komorka'+komorki[i]).style.backgroundColor = kolory[i];


na to:
Kod
document.getElementById(komorki[i]).style.backgroundColor = kolory[i];
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: 20.08.2025 - 05:45