how to return a value from JavaScript to pageload function
<p>I am calling my JavaScript function in page load</p>

<p>JScript File:</p>

<pre><code>function fnCheckBrowserType()
{
  if(navigator.appName == "Microsoft Internet Explorer" || navigator.appName == "Netscape")
  {
    //document.all["HhdnBrowsertype"].value=navigator.appName 
    document.all["HhdnBrowsertype"].value="1"
    alert(document.getElementById("HhdnBrowsertype").value); 
  }
  else
  {
    //document.getElementById("HhdnBrowsertype").value = navigator.appName 
    document.all["HhdnBrowsertype"].value="0"
    alert(document.getElementById("HhdnBrowsertype").value); 
  }
}
</code></pre>

<p>ASP.NET code behind:</p>

<pre><code>protected void Page_Init(object sender, EventArgs e)
{
  Page.ClientScript.RegisterStartupScript(typeof(string), "fnCheckBrowserType", "fnCheckBrowserType();", true);

  if (HhdnBrowsertype.Value.ToString() == "1")
  {
    int IE = 1;
  }
  else
  {
    int opera = 0;
  }
}
</code></pre>

<p>HTML:</p>



<pre class="lang-html prettyprint-override"><code>&lt;script src="Browsers.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
  &lt;title&gt;Untitled Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;form id="form1" runat="server"&gt;
    &lt;div&gt;
      &lt;%--&lt;input id="HhdnBrowsertype" type="hidden" name="HhdnBrowsertype" runat="server" /&gt;--%&gt;
      &lt;asp:HiddenField ID="HhdnBrowsertype" runat="server" /&gt;
    &lt;/div&gt;
  &lt;/form&gt;
&lt;/body&gt;
</code></pre>

<p>In pageload i am calling my javascript  function here  i am setting the hiddden field value  "0" or "1"
 based on the  browser type
 but in page  load HhdnBrowsertype  value is  always  empty</p>

<p>is there anyway from javacript  i return an value  based on that value  i set my hidden   field in page load</p>

<p>Please  help  in me   how  i can return an vlaue "0" or "1" from javscript  to   page load  function</p>

<p>thanks </p>
