title: Defining a html class with a Javascript function
body: <p>I'm developing a website and I'm having some trouple..
  I want to define my class using a Javascript function, like so:</p>
  
  <p>html code:</p>
  
  <pre><code>&lt;script type="text/javascript" src="../js/active_menu.js"&gt;&lt;/script&gt;
  &lt;a id="demo" class="&lt;script&gt;document.write(myFunction('index.php'));&lt;/script&gt;" href="index.php"&gt;Home&lt;/a&gt;
  </code></pre>
  
  <p>javascript code:</p>
  
  <pre><code>function myFunction(menu_punkt)
  {
  var state = 'not_active'
  var a = document.URL.split("//");
  a = (a[1] ? a[1] : a[0]).split("/"); 
  a = a[1];
  
  if (menu_punkt == a){
      state = 'navactive';
  }
  return state
  }
  </code></pre>