I wouldn't do it with javascript but with PHP. Even though you can do it with javascript it is not as neat.
where some.php can be the name of any page or just any string
Javascript version:
if(window.location.pathname.indexOf("some.php") > 0)
{
document.getElementById("menu").className="active";
}
window.location.pathname returns a string with the name of the current page preceded by a \
indexOf detects if some.php can be found within that string and returns its position
PHP version:
if(strpos($_SERVER['PHP_SELF'], "some.php") > 0)
{
echo "<div class='active'>$your webpage</div>"; //depending on the structure of your site
}
works the same way as the javascript statement above, except this time the function is strpos
There are certainly better ways to do in PHP, but it depends on how your website is structured.