🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.javascript
4 messages
4 total messages Started by web Sun, 06 Sep 2009 09:30
wyciagniecie skladnikow adresu
#49286
Author: web
Date: Sun, 06 Sep 2009 09:30
9 lines
1321 bytes
witam

szanowni panstwo

jak ze zmiennej przetrzymujacej adres fotki wyciagnac skladniki (host,
katalog, plik)

bardzo bede wdzieczny za podpowiedz....chyba tego JS sie nigdy nie
naucze..dzialam po omacku
Re: wyciagniecie skladnikow adresu
#49287
Author: Peter
Date: Sun, 06 Sep 2009 10:13
15 lines
1233 bytes
web pisze:
> witam
> 
> szanowni panstwo
> 
> jak ze zmiennej przetrzymujacej adres fotki wyciagnac skladniki (host,
> katalog, plik)
> 
> bardzo bede wdzieczny za podpowiedz....chyba tego JS sie nigdy nie
> naucze..dzialam po omacku

http://republika.onet.pl/13965,15334,14,05,kursy.html

-- 
Peter
Re: wyciagniecie skladnikow adresu
#49288
Author: web
Date: Sun, 06 Sep 2009 14:17
27 lines
1986 bytes
>
> http://republika.onet.pl/13965,15334,14,05,kursy.html
>


ok..nie dam rady..wiec podam przyklad (w zasadzie to jQuery)

mam taki zapis, ktory dla znacznika <img> nadaje adres

$('#adres-zdiecia).attr('src',settings.imageArray[settings.activeImage]
[0]);

musze jednak przerobic odrobine ten skrypt i potrzebne mi sa z
'settings.imageArray[settings.activeImage][0]' wszystkie skladniki
adresu

czyli z adresu http://localhost/katalog1/katalog2/plik.jpg   musze
wyodrebnic katalog1, katalog2, plik.jpg

nie wiem jak to ugryzc z tym location

a moze jest jakas inna funkcja rozbijajaca string po ukosnikach??


pozdrawaim
Mirek
Re: wyciagniecie skladnikow adresu
#49289
Author: Peter
Date: Sun, 06 Sep 2009 16:46
38 lines
1887 bytes
web pisze:
>> http://republika.onet.pl/13965,15334,14,05,kursy.html
>>
> 
> 
> ok..nie dam rady..wiec podam przyklad (w zasadzie to jQuery)

jQuery do tego nie jest potrzebne.

> mam taki zapis, ktory dla znacznika <img> nadaje adres
> 
> $('#adres-zdiecia).attr('src',settings.imageArray[settings.activeImage]
> [0]);
> 
> musze jednak przerobic odrobine ten skrypt i potrzebne mi sa z
> 'settings.imageArray[settings.activeImage][0]' wszystkie skladniki
> adresu
> 
> czyli z adresu http://localhost/katalog1/katalog2/plik.jpg   musze
> wyodrebnic katalog1, katalog2, plik.jpg

var h = document.location.pathname;
var t = h.split("/");
var i = t.length, a = [];
while(i--){
  a.push(t[i]);
}

> nie wiem jak to ugryzc z tym location

"Z palca" pisałem i nie sprawdzałem czy zadziała.

> a moze jest jakas inna funkcja rozbijajaca string po ukosnikach??

split("/");

-- 
Peter
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads