Javascript add class and keep original
<p>Im using the following:</p>

<pre><code>url=location.href
fname=url.match(/.*\/(.*)\./)[1]
document.body.className=fname
</code></pre>

<p>This takes part of the URL and adds a class to the <code>&lt;body&gt;</code> tag with the text extracted from the URL.</p>

<p>However the problem with this method is the class only gets applied providing  doesnt already have a class assigned. </p>

<p>Im really looking for something similar to the JQUERY <code>.addClass</code> function so body becomes:</p>

<pre><code>&lt;body class="originalClass filenameClass"&gt;

...

&lt;/body&gt;
</code></pre>
