Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> czy js moze korzystać z get?
1010
post 2.09.2007, 21:41:39
Post #1





Grupa: Zarejestrowani
Postów: 749
Pomógł: 37
Dołączył: 3.10.2006

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


Czy mozna w js w jakiś sposób wstawic wartość z get?


--------------------
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
skowron-line
post 2.09.2007, 21:45:13
Post #2





Grupa: Zarejestrowani
Postów: 4 340
Pomógł: 542
Dołączył: 15.01.2006
Skąd: Olsztyn/Warszawa

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


a probowales wogole??
  1. var a = document.getElementById('div');
  2. a.innerHTML = <?php echo $_GET[zmienna]; ?>


--------------------
I'm so fast that last night I turned off the light switch in my hotel room and was in bed before the room was dark - Muhammad Ali.
Peg jeżeli chcesz uprawiać sex to dzieci muszą wyjść, a jeżeli chcesz żeby był dobry ty też musisz wyjść - Al Bundy.

QueryBuilder, Mootools.net, bbcradio1::MistaJam
http://www.phpbench.com/
Go to the top of the page
+Quote Post
nitro18
post 2.09.2007, 22:14:17
Post #3





Grupa: Zarejestrowani
Postów: 311
Pomógł: 7
Dołączył: 2.08.2006
Skąd: Bystrzyca Kłodzka/Nysa

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


oczywiście że może. Patrz wyżej.

Warn za nabijanie postów. (Sabistik)
Go to the top of the page
+Quote Post
SHiP
post 3.09.2007, 13:28:39
Post #4





Grupa: Zarejestrowani
Postów: 697
Pomógł: 47
Dołączył: 19.12.2003
Skąd: Lublin

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


Wydaje mi się, że autorowi tematu o cos innego chodziło tzn wczytywanie danych z $_GETa ale bez użycia php.

Kiedys cos takiego pisałem. Adres jest przechowywany w zmiennej window.location Wystarczy poczytać troche o funkcji split() i podzelić wg. znaka zapytania i ampersandu... nastpnie wydzielic nazwy parametrow i wartosci. Zrobic z tego tablice globalną i powinno działać biggrin.gif


--------------------
Warsztat: Kubuntu, PhpStorm, Opera
Go to the top of the page
+Quote Post
php programmer
post 3.09.2007, 13:49:33
Post #5





Grupa: Zarejestrowani
Postów: 1 045
Pomógł: 5
Dołączył: 8.11.2004
Skąd: trójmiasto

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


Mój wujek google mówi, że tak

http://scripts.franciscocharrua.com/javasc...t-variables.php

Kod
function getVar(name)
         {
         get_string = document.location.search;        
         return_value = '';
        
         do { //This loop is made to catch all instances of any get variable.
            name_index = get_string.indexOf(name + '=');
            
            if(name_index != -1)
              {
              get_string = get_string.substr(name_index + name.length + 1, get_string.length - name_index);
              
              end_of_value = get_string.indexOf('&');
              if(end_of_value != -1)                
                value = get_string.substr(0, end_of_value);                
              else                
                value = get_string;                
                
              if(return_value == '' || value == '')
                 return_value += value;
              else
                 return_value += ', ' + value;
              }
            } while(name_index != -1)
            
         //Restores all the blank spaces.
         space = return_value.indexOf('+');
         while(space != -1)
              {
              return_value = return_value.substr(0, space) + ' ' +
              return_value.substr(space + 1, return_value.length);
                            
              space = return_value.indexOf('+');
              }
          
         return(return_value);        
         }


Ten post edytował php programmer 3.09.2007, 13:50:43
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: 14.08.2025 - 02:07