Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Skrypt dynamicznej zmiany informacji..
raxon
post 11.07.2011, 07:19:58
Post #1





Grupa: Zarejestrowani
Postów: 44
Pomógł: 0
Dołączył: 30.06.2009

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


Poszukuję skryptu który po naciśnięciu w kategorię bez przeładowania strony wyświetli on 4 jakieś tam wczytane informacje.

A tutaj jest ot rozrysowane na obrazku.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
k4r3r
post 11.07.2011, 10:06:33
Post #2





Grupa: Zarejestrowani
Postów: 43
Pomógł: 1
Dołączył: 6.07.2011

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


W index:

  1. <script type="text/javascript" src="myscripts.js"></script>


W myscripts.js:

  1. function get(plik, target, noinfo, refresh){
  2. if (document.getElementById('loader').style.visibility == "hidden") {
  3. if (noinfo != 1) {
  4. if (noinfo == undefined) {noinfo = "";}
  5. if (target != undefined) {document.getElementById('loader').style.visibility="visible";}
  6. }
  7. var xmlHttp;
  8. xmlHttp=new XMLHttpRequest();
  9.  
  10. xmlHttp.onreadystatechange=function(){
  11. if(xmlHttp.readyState==4){
  12. resp = xmlHttp.responseText;
  13. if (resp == null)
  14. resp = "B??d, pon?w ??danie.";
  15.  
  16. if (target != undefined) {document.getElementById(target).innerHTML=resp;}
  17. if (refresh != undefined) {
  18. if (refresh == 'page') {
  19. location.reload();
  20. } else if (refresh.indexOf("-") != -1) {
  21. split = refresh.split("-");
  22. get(split[0], split[1], 1);
  23. } else if (refresh.indexOf("(") != -1 & refresh.indexOf(")") != -1) {
  24. setTimeout(refresh, 100);
  25. }
  26. }
  27. if (target != undefined) {document.getElementById('loader').style.visibility="hidden";}
  28. }
  29. }
  30. xmlHttp.open("GET", plik);
  31. xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  32. xmlHttp.setRequestHeader("Connection", "close");
  33. xmlHttp.send(null);
  34. }
  35. }


Potem w linku:

  1. <a href="#" onClick="get('plik.php', 'id_diva')">Test</a>
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: 24.07.2025 - 15:39