🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.javascript
Article #49289

Re: wyciagniecie skladnikow adresu

#49289
From: 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
Technical Details
Message-ID: <h80e27$r8$1@node1.news.atman.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!newsfeed.atman.pl!not-for-mail
References: <9ae04239-9c76-419b-a9a2-209500f481a3@g19g2000yqo.googlegroups.com> <h801q3$5rq$1@node2.news.atman.pl> <ae4fd808-0eb8-445a-8c69-cd560f65123f@j4g2000yqa.googlegroups.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!newsfeed.atman.pl!not-for-mail
From: Peter <peter.may@poczta.fm>
Newsgroups: pl.comp.lang.javascript
Subject: Re: wyciagniecie skladnikow adresu
Date: Sun, 06 Sep 2009 18:46:07 +0200
Organization: ATMAN
Lines: 38
Message-ID: <h80e27$r8$1@node1.news.atman.pl>
References: <9ae04239-9c76-419b-a9a2-209500f481a3@g19g2000yqo.googlegroups.com>  <h801q3$5rq$1@node2.news.atman.pl> <ae4fd808-0eb8-445a-8c69-cd560f65123f@j4g2000yqa.googlegroups.com>
NNTP-Posting-Host: inet20907na-0.nat.umts.dynamic.eranet.pl
Mime-Version: 1.0
X-Trace: node1.news.atman.pl 1252244359 872 213.158.199.64 (6 Sep 2009 13:39:19 GMT)
X-Complaints-To: usenet@atman.pl
NNTP-Posting-Date: Sun, 6 Sep 2009 13:39:19 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
In-Reply-To: <ae4fd808-0eb8-445a-8c69-cd560f65123f@j4g2000yqa.googlegroups.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit