Results 1 to 4 of 4

Thread: Setting session variable thr. javascript

  1. #1

    Thread Starter
    Hyperactive Member aks_1610's Avatar
    Join Date
    Sep 2002
    Location
    Pune, India
    Posts
    280

    Setting session variable thr. javascript

    hi all,

    is there any way to set Session variable from javascript in asp.
    A man with nothing to live for has everything to fight for...

  2. #2
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    No - javascript is client side; ASP is server side.

    What you could do though, is use javascript to set a hidden variable's value & post the page back to itself, setting the session variable then.

    Code:
    <%
      Dim MyValue
      MyValue = Request.Form("hidValue")
    %>
    <html>
    <head>
      <title>Blah</title>
      <script language="javascript" type="text/javascript">
        function postBack(myValue) {
          var theForm = document.frmBlah;
          theForm.hidValue.value = myValue;
          theForm.submit();
        }
      </script>
    </head>
    <body>
      <form id="frmBlah" name="frmBlah" method="post">
        <input type="hidden" id="hidValue" name="hidValue">
      </form>
    </body>
    </html>

  3. #3
    Frenzied Member andreys's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,615
    Originally posted by axion_sa
    No - javascript is client side; ASP is server side.
    Javascript could be a server side script as weel
    Visit my PROJECTS @ www.asprojects.com

  4. #4
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    Originally posted by andreys
    Javascript could be a server side script as weel
    Granted, but I think the context here was client side - could be wrong

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width