I tried to create a javascript switch statement that basically sees if the window.location matches the url and if it does, it will display that code. I have 7 tabs, and one is selected depending on which page you are on, so Im trying to make a javascript function that traces the url and if matches a variable, then it displays that code.
Does anyone know why this wont work?
Here is my code:
switch (window.location.protocol)
{
case "http://centi.lmm.local/dLife/do/ShowContent/about_lmm/mediakit/mediakit_index.html":
document.write("<div id="nav">
<ul>
<li id=current><a href="/dLife/do/ShowContent/about_lmm/mediakit/mediakit_index.html">Home</a> </li>
<li ><a href="/dLife/do/ShowContent/about_lmm/mediakit/mediakit_offerings.html">Offerings</a> </li>
<li ><a href="/dLife/do/ShowContent/about_lmm/mediakit/dlife_study.html">dLife Study</a> </li>
<li ><a href="/dLife/do/ShowContent/about_lmm/mediakit/advisory_board/index.html">Advisory Board</a> </li>
<li ><a href="/dLife/do/ShowContent/about_lmm/mediakit/press_releases/dlife_news_index.html">dLife in the News</a> </li>
<li ><a href="/dLife/do/ShowContent/about_lmm/mediakit/mediakit_about_lmm.html">About LifeMed Media</a> </li>
<li ><a href="/dLife/do/ShowContent/about_lmm/mediakit/contact_us.html">Contact Us</a> </li>
</ul></div>
")
break
case "http://centi.lmm.local/dLife/do/ShowContent/about_lmm/mediakit/mediakit_offerings.html":
document.write("<div id="nav">
<ul>
<li ><a href="/dLife/do/ShowContent/about_lmm/mediakit/mediakit_index.html">Home</a> </li>
<li id=current><a href="/dLife/do/ShowContent/about_lmm/mediakit/mediakit_offerings.html">Offerings</a> </li>
<li ><a href="/dLife/do/ShowContent/about_lmm/mediakit/dlife_study.html">dLife Study</a> </li>
<li ><a href="/dLife/do/ShowContent/about_lmm/mediakit/advisory_board/index.html">Advisory Board</a> </li>
<li ><a href="/dLife/do/ShowContent/about_lmm/mediakit/press_releases/dlife_news_index.html">dLife in the News</a> </li>
<li ><a href="/dLife/do/ShowContent/about_lmm/mediakit/mediakit_about_lmm.html">About LifeMed Media</a> </li>
<li ><a href="/dLife/do/ShowContent/about_lmm/mediakit/contact_us.html">Contact Us</a> </li>
</ul></div>
")
break
}