Results 1 to 4 of 4

Thread: Javascript to ASP variable

  1. #1

    Thread Starter
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303

    Question Javascript to ASP variable

    How can I pass a variable set in Javascript to an ASP style variable?
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

  2. #2
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    Hi parkes

    if you mean sending the javascript variable to the same page in the same same hit, you can't as asp is completly server side and can't interact with client side scripting. but if you mean you just want to sen the variable to another asp page you could put it in the query string or in a hidden html field and post it off to the next page.

    Hope this helps

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  3. #3

    Thread Starter
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303
    Thanks that's what I thought and have been trying but for some reason it will not work

    Here is the code any ideas?

    <%
    Response.write "<INPUT TYPE='button' NAME='view' VALUE='V' TITLE='View/Change full details' CLASS='btn2' onClick=""MM_goToURL('parent','companydet.asp?ID=" & Request.Form("companyref") & "&type=view&logid=" & sRef & "');return document.MM_returnValue"">"
    %>

    It doesn't pass 'companyref' across, though the value is set in the form field and I've even tried Request.Querystring and still no luck.
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

  4. #4
    Lively Member
    Join Date
    Mar 2001
    Location
    Sweden
    Posts
    115
    Is the field companyref in the same form as the button? In that case, what you're trying to do is impossible.
    Request.Form("companyref") gets the value from the object companyref in the form posted to another page.
    Try using Javascript instead (document.myform.companyref.value)

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