navigation menu help

They have: 3 posts

Joined: Apr 2003

http://www.microsoft.com/usa/teched/home.asp

the left side menu can remember(highlight) the position which you clicked on the other page.

please help me how can i do it!! I am not good at javascript.

thank you very much!!!

DaveyBoy's picture

They have: 453 posts

Joined: Feb 2003

hmmm well i am sure there are some codes to do this, but can't you just highlight it yourself on the respective page? That is assuming you have the nav on the page itself and not as a script.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

If you do have a script, you can use server-side scripting to set a flag or id that the JavaScript can then read, but it's fairly difficult to make suggestions beyond this without seeing your page.

http://secrets.synapticimpulse.com/ uses php scripting to set conditional CSS. The CSS controls the highlighting. You're welcome to view the source.

You can use it in static pages as well (no JavaScript needed), by doing what I have in the source (style element in the head for the currently active page), as DaveyBoy suggested.

If you have it scripted, ask in the Scripting forum here and I will post how I did the scripting. Someone else will be able to likely give you a better option (for scripting) as well.

They have: 3 posts

Joined: Apr 2003

Thanks for reply!!

I know how to highlight the menu item when mouse over or click the menu item using css and javascript ,but it works on the same page not a new opened page.

He has: 1,758 posts

Joined: Jul 2002

Hi,

We used this method at welsh-historic-inns.com as well... its fairly simple... just set a flag at the top of the page ie

<?php $page="about"; ?>'

then put an if statement so that if your on that page the css is set to .menu_on rather than .menu_off or something...

Heres an example of the code, it might be a bit messy, but it does the job...

<?php
if ($page_type == "about") {
$about_class = "logoColumn";
}
if (
$page_type == "news") {
$news_class = "logoColumn";
}
if (
$page_type == "links") {
$links_class = "logoColumn";
}
if (
$page_type == "contact") {
$contact_class = "logoColumn";
}
?>


<!-- menu -->
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td class="<?php echo $about_class; ?>"
onMouseOver="this.className='logoColumn';"
onMouseOut="this.className='<?php echo $about_class; ?>';"
onMouseUp="location.href='about.php'">
<img src="images/pix_spacer.gif" width="4" height="19" border="0" align="absmiddle">
<a href="about.php" class="menu">About
            Us</a></td>
        </tr>
'

Andy

He has: 1,758 posts

Joined: Jul 2002

oops... aplogies for knocking the page out so far...

They have: 3 posts

Joined: Apr 2003

I am so sorry ,I don't know anything about php!

thank you all the same for your help!! Thanks andy206uk!!

They have: 37 posts

Joined: Mar 2003

wow that is pretty useful... I may be using that... thanks

He has: 1,758 posts

Joined: Jul 2002

thats just a direct cut from the code we use... it can be much simpler. php isnt all that complicated, and theres loads of easy scripts out there on the net! i dont know how i coped before i learnt php!

Andy

He has: 1,380 posts

Joined: Feb 2002

theres a way to do it in dhtml...check out dynamicdrive.com

He has: 1,758 posts

Joined: Jul 2002

ahhhhh dynamic drive... i remember that from when i first got started... Wink i got my first mouse trail script from their! Wink

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.