Script: DD Drop Tab Menu
Url: http://www.dynamicdrive.com/dynamici...roptabmenu.htm

Problem: 'selected' tab is not given a class of 'selected' when using ajax

Testing url: http://butterflyepidemic.com/test_2

Background: see my previous question:
http://www.dynamicdrive.com/forums/s...ent-from-a-div



To load only the new content, I was able to load in an external div with jQuery's load function.

I found this tutorial helpful:
http://code.tutsplus.com/tutorials/h...jquery--net-26

It works great as far as I can see, except for one hitch:

the 'selected' tab is not given a class of 'selected' and therefore does not get special style.

As I understand it, to give the 'selected tab' it's style, the script grabs the url and compares it to the href of the button clicked.

As I'm using ajax, the url is now generated as a hashed appendix to the root (as per the tutorial above):

www.example.com/#about

but I think 'drop down menu' expects something normal (non ajax):

www.example.com/about.php


In order to check for a match, I'm thinking I can grab the hash value with, e.g.

window.location.hash.substr(1)

which gives "about"

then concatenate ".php" to it, such as

window.location.hash.substr(1)+".php"

so I get:

about.php



I can get this far in my head, but I would like to know how to compare the two and add the class. My attempt is not working:

if (this.isSelected(menuitems[i].href) == window.location.hash.substr(1)+".php") {
menuitems[i].parentNode.className+=" selected default"
}

I'm guessing I got the left part of the equation wrong as I'm unsure of the syntax.