Javascript and ASP

Results 1 to 2 of 2

Thread: Javascript and ASP

  1. #1
    Join Date
    Dec 1969

    Default Javascript and ASP

    How can I do to pass the value of a variable from javascript to ASP???

  2. #2
    Join Date
    Dec 1969

    Default Well...

    Javascript is a client side Scripting language that enable you to write code that the browser will interpret.<BR><BR>ASP is a technology that enables you to write Server Side code, meanhing that your code is interpreted by the server.<BR><BR>The server then outputs some HTML or javascript(Client Side of course!)<BR><BR>So you can make a Server Side variable affect a javascript function like so:<BR><BR>&#060;script language="javascript"&#062;<BR>function MyFunction()<BR>{<BR> var MyServerSideValue<BR> MyServerSideValue = &#060;%=ValueOfMyVariable%&#062;<BR>}<BR>&#060;/script&#062;<BR><BR><BR>This will/should work cause the server side code is interpreted first that&#039;s why it outputs html code<BR><BR>But the other way around doesn&#039;t work!<BR><BR>Unless you assign your javascript variable to a &#060;hidden&#062; field, then submit your page, then the server will retrieve the value from that &#060;hidden&#062; field<BR><BR><BR>If I&#039;m wrong please correct me ;)

Posting Permissions

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