Javascript function using code behind called onPageLoad instead onClick
<p>I have an HTML button that onClick should invoke two functions:</p>

<pre><code>&lt;input id="btnLogout" onclick="test();SaveAndNavigate('logoff.aspx');" type="button"&gt;
</code></pre>

<p>In the function test() I simply need to write/append in a .txt file (on the Server side) the username. The txt file is a log file and I want to keep track when the current user logs out.</p>

<p>The function test is:</p>

<pre><code>function test()
{
&lt;%
   LogUserSession("User: "+ System.Web.HttpContext.Current.ApplicationInstance.Session.SessionID.CurrentUser +" logged out on: " + System.DateTime.Now );
%&gt; 
}
</code></pre>

<p>When I load the page with the button, the function is executed immediately on pageload instead of onClick event.
Since what I need to achieve is already all implemented by the codeBehind function "LogUserSession", I would like to avoid having to develop jQuery Ajax web services or other solutions, if possible.</p>

<p>Otherwise how can I append text info to an existing .txt file from javascript?
Thanks in advance.</p>
