hello all, I hope I can get help here. I am newbie in java script and I am trying to do the following:
I have a navigation bar on my website (made of link text, the color of the text is defined by a css style, in any case the text is white when the page loads and is red when it gets rolled over) What I want is when a vistor for example presses the “machine” button and gets directed to the page “machine.asp” which displays the same navigaton, I want the text for the link “machine” on my navigation to change to red for example and stay that way, that way the visitor will know what page s/he is on.
structure of website:
Each page (home.asp, machine.asp, ingredients.asp, etc.) includes a header called (head.asp) and a footer (foot.asp)
[URL]http://www.always-coffee.com/web2/index.asp
What I did:
I added the following javascript in head.asp:
<!– Original: Kevin Lynn Brown Modefied by Layth–>
<!– Begin
var path = “”;
var nav = “”;
var href = document.location.href;
var s = href.split(“/”);
for (var i=2;i<(s.length-1);i++) {
}
i=s.length-1;
path+=s[i];
if (path == “always-coffee-office-solution_main.asp”){
nav=”main”;
var nav =””;
}
// End –>
Now here is my problems (or what I think My problems is):
2- now if I get the first part right, then I can add more if statments to include all websites for the navigation part. BUT my biggest problem, is how do I get the text change color if the value of the variable nav=”main” for example. AND where do I place that code in my document. PLEASE HELP. and I thank you in advance.
Layth