Article View: pl.comp.lang.javascript
Article #39660Re: Tego kawałka kodu nie rozumiem
From: Grzegorz Sobala
Date: Wed, 26 Apr 2006 08:26
Date: Wed, 26 Apr 2006 08:26
36 lines
2028 bytes
2028 bytes
Jacek Karczmarczyk napisał(a):
> Grzegorz Sobala napisał(a):
>
>> function showResult(answer) {
>> menuDiv = document.getElementById('menu');
>> eval(answer);
>> htmlInside = '';
>> for(iter = 0; iter<menu.length; iter++) {
>>
>> if (menu[iter][2]=='') htmlInside += '<div
>> rozum="get_submenu(this.parentNode)" class="menu"
>> id="'+menu[iter][0]+'"><span onclick="get_submenu(this.parentNode)"
>> ...
>>
>> Do czego się tutaj odwołuje this i parentNode ?
>
>
> w spanie - this do spana, no a parentNode do diva
> w divie - this do diva, parentNode do jego rodzica
>
Nie wiem czy to coś zmieni, ale zapomniałem napisać, że w/w funcja jako
parametr answer dotaje:
function getMenu() {
$sql = 'SELECT * FROM menu WHERE parent=0';
$result = mysql_query($sql);
$menuList = '';
while($data = mysql_fetch_assoc($result))
$menuList .= 'menu.push(new Array('.$data['id'].',
\''.$data['name'].'\', \''.$data['link'].'\'));'."\r\n";
return $menuList;
}
Pozdrawiam
Grzegorz Sobala
Technical Details
Message-ID:
<e2naui$51e$1@atlantis.news.tpi.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.internetia.pl!newsfeed.tpinternet.pl!nemesis.news.tpi.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mailReferences:
<e2n990$s93$1@atlantis.news.tpi.pl> <e2n9ma$1idq$1@node3.news.atman.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.internetia.pl!newsfeed.tpinternet.pl!nemesis.news.tpi.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail From: Grzegorz Sobala <gogo12@interia.pl> Newsgroups: pl.comp.lang.javascript Subject: Re: Tego kawałka kodu nie rozumiem Date: Wed, 26 Apr 2006 10:26:35 +0200 Organization: tp.internet - http://www.tpi.pl/ Lines: 37 Message-ID: <e2naui$51e$1@atlantis.news.tpi.pl> References: <e2n990$s93$1@atlantis.news.tpi.pl> <e2n9ma$1idq$1@node3.news.atman.pl> NNTP-Posting-Host: abwl88.neoplus.adsl.tpnet.pl Mime-Version: 1.0 X-Trace: atlantis.news.tpi.pl 1146040082 5166 83.8.235.88 (26 Apr 2006 08:28:02 GMT) X-Complaints-To: usenet@tpi.pl NNTP-Posting-Date: Wed, 26 Apr 2006 08:28:02 +0000 (UTC) User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: pl, en-us, en In-Reply-To: <e2n9ma$1idq$1@node3.news.atman.pl> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit