I am posting my question again because I believe the title was a little misleading. What is wrong with this code?? I use it so determine if you are filtering by a certain type Javascript replaces the link to the filter with bold text. For example: when you are filtering, the address of my site contains /search/label/(tag). So, if you were filtering by How-To’s the address would be /search/label/how-to. When Javascript checks document.location.href.index.Of(“/search/label/how-to”) == -1 it evaluates false (Since it is there). So instead of displaying a link to filter by How-To’s, Javascript makes the Text: How-To’s bold to indicate it is the current filter. I have tried using many online validators, but I have had no luck. Please Help! Here is my code:
[CODE]
if (window.location.href.indexOf(“/search/label/articles”) == -1)
{
document.write(“<li><a href=’/search/label/articles’>Articles (4)</a></li>”);
}
else
{
document.write(“<li><b>Articles (4)</b></li>”);
}
if (window.location.href.indexOf(“/search/label/how-to”) == -1)
{
document.write(“<li><a href=’/search/label/how-to’>How-To’s (2)</a></li>”);
}
else
{
document.write(“<li><b>How-To’s (2)</b></li>”);
}
if (window.location.href.indexOf(“/search/label/tip”) == -1)
{
document.write(“<li><a href=’/search/label/tip’>Tips (2)</a></li>”);
}
else
{
document.write(“<li><b>Tips (2)</b></li>”);
}
if (window.location.href.indexOf(“/search/label/tutorial”) == -1)
{
document.write(“<li><a href=’/search/label/tutorial’>Tutorials (1)</a></li>”);
}
else
{
document.write(“<li><b>Tutorials (1)</b></li>”);
}
Thanks!!!