title: Call javascript function in c# actionlink
body: <p>Im trying to re-write this code to c# just for education purpose, i cant get it working tho :( what am i missing?</p>
  
  <pre><code>&lt;a href="javascript:document.getElementById('logoutForm').submit()"&gt;Log off&lt;/a&gt;
  </code></pre>
  
  <p>This is how far i've gotten:</p>
  
  <pre><code> @Html.ActionLink("Log off", "", "", new { onclick = "LogOutLink();" })
  </code></pre>
  
  <p>and the javascript:</p>
  
  <pre><code> &lt;script&gt;
  function LogOutLink() {
      document.getElementById('logoutForm').submit();
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>what am i missing? since i dont want the link to call any specific view or controller i have just left them blank as u can see, but it still wants to call for that function</p>