Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> zmienna GET w JavaScript
php programmer
post
Post #1





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

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


Witam mam skrypt o adresie
www.stronka.pl/index.php?parametr1=wartosc1&parametr2=wartosc2

i teraz nie wiem jak pobrać wartość parametru,
w php bym miał po prostu
  1. <?php
  2. $_GET['parametr1']
  3. ?>


a w JavaScript (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif)

Ten post edytował php programmer 22.08.2006, 09:50:27
Go to the top of the page
+Quote Post
revyag
post
Post #2





Grupa: Przyjaciele php.pl
Postów: 2 258
Pomógł: 16
Dołączył: 21.09.2004
Skąd: Kielce

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


http://www.dynamicdrive.com/forums/showthread.php?t=11883
Go to the top of the page
+Quote Post
php programmer
post
Post #3





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

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


THX revyag. JavaScript chyba nie ma przed toba tajemnic!
Go to the top of the page
+Quote Post
nospor
post
Post #4





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




Ale tu nie trzeba znac js, tylko google (IMG:http://forum.php.pl/style_emoticons/default/tongue.gif)
http://www.google.com/search?hl=pl&cli...=Szukaj&lr=
http://www.11tmr.com/11tmr.nsf/d6plinks/MWHE-695L9Z
I mamy bardzo ciekawa funkcje:
Kod
function getURLParam(strParamName){
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("?") > -1 ){
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      if (
aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  return strReturn;
}
Go to the top of the page
+Quote Post
php programmer
post
Post #5





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

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


Dzięki,
no właśnie w google szukałem
"get JavaScript" ale nic nie mogłem znaleźć
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 20:42