![]() |
![]() |
![]()
Post
#1
|
|
![]() Grupa: Zarejestrowani Postów: 422 Pomógł: 0 Dołączył: 14.12.2005 Skąd: Wałbrzych Ostrzeżenie: (0%) ![]() ![]() |
mam taka funkcje w js
Kod function sort( what, type ) { advAJAX.get({ url: "punkty_ajax.php?what="+what+"&type="+type, onLoading : function(obj) { $("dane").innerHTML = ''; $("dane").style.display = 'none'; $("loading").style.display = ''; }, onSuccess : function(obj) { if( obj.responseText == 'ERROR' ) { alert( 'Wystąpił błąd !'); return; } $("dane").innerHTML = obj.responseText; $("dane").style.display = ''; $("loading").style.display = 'none'; } }); } i wywolluje ja tak Kod <a href="java script: sort( \'name\', \'asc\' );">Admin</a> <a href="java script: sort( \'punkty\', \'asc\' );"> i teraz nie wiem w jaki sposob przerobic ten skrypt ze jesli aktualnie wywolany tryb to asc ( osobno w kazdym przypadku - name, punkty ) to zmienia sie na desc jesli desc to na asc.... w jaki sposob to rozegrac ? prosze o pomoc :/ wymyslilem sobie cos takiego Kod function sort( what ) { var sortName = $('sortName'); var sortPunkty = $('sortPunkty'); var sortType; if( sortName == '' && what == 'name' ) { sortName.innerHTML = 'desc'; sortType = 'desc'; } else if( sortName == 'desc' && what == 'name' ) { sortName.innerHTML = 'asc'; sortType = 'asc'; } else if( sortName == 'asc' && what == 'name' ) { sortName.innerHTML = 'desc'; sortType = 'desc'; } if( sortPunkty == '' && what == 'punkty' ) { sortPunkty.innerHTML = 'desc'; sortType = 'desc'; } else if( sortPunkty == 'desc' && what == 'punkty' ) { sortPunkty.innerHTML = 'asc'; sortType = 'asc'; } else if( sortPunkty == 'asc' && what == 'punkty' ) { sortPunkty.innerHTML = 'desc'; sortType = 'desc'; } advAJAX.get({ url: "punkty_ajax.php?what="+what+"&type="+sortType, onLoading : function(obj) { $("dane").innerHTML = ''; $("dane").style.display = 'none'; $("loading").style.display = ''; }, onSuccess : function(obj) { if( obj.responseText == 'ERROR' ) { alert( 'Wystąpił błąd !'); return; } $("dane").innerHTML = obj.responseText; $("dane").style.display = ''; $("loading").style.display = 'none'; } }); } i dodalem dwa divy ale to nie dziala :/ Ten post edytował Balon 28.05.2006, 17:21:17 -------------------- Postura wielka i morda wredna, jestem Balon, kozak z osiedla !
bzdury.pl - Królestwo rozrywki |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 19.07.2025 - 07:54 |