Reply to Re: JavaScript, menu+php ?

Your name:

Reply:


Posted by Rik on 07/28/06 12:57

Yves Lange wrote:
> Neredbojias a ιcrit :
>> To further the education of mankind, Yves Lange
>> <yves.lange@bluewin.ch> vouchsafed:
>>
>>> Hello i wrote a little script in JavaScript which makes my menu
>>> dynamic. The menu can move with the window while the user moves up
>>> or down. But the problem is that when a user click on a link (of
>>> this menu) i want that the background of the cell

Cell? Since when is navigation tabular data? I'd use a ul.

>>> stay in a
>>> specific color which will be useful for the user to know which page
>>> he is reading. How can i do that ?
>>
>> Use the hash and attach it to the url.
>>
> I used PHP...

Quick & easy solution:
I have several pages qith unique names, which are valid classnames.
On every pageload the class of the body is set to that name, and in the list
(and elsewhere), the li's have also classes. The following CSS takes care of
the rest:

..page1 .nav_page1{background-color: #020202;}
..page2 .nav_page2{background-color: #020202;}
..page3 .nav_page3{background-color: #020202;}

Offcourse, if you're building the page using PHP, nothing stops you to make
a class "selected", and check which page is requested with PHP. Just attach
the class to the navigation item of the loaded page.

Grtz,
--
Rik Wasmus

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация