Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Location
    Brighton, UK
    Posts
    282
    Thanks
    1
    Thanked 0 Times in 0 Posts

    combine asp with javascript

    I am trying to combine javascript with ASP

    i have a javascript var that i am trying to pass over to ASP

    for example..

    i am picking up javascriptroducts('name')

    function products(URL) {
    window.alert(URL);
    }

    i am now trying to pick the value of URL and add it to my ASP code

    for example

    <%
    Dim URLValue

    URLValue = Javascript URL
    %>
    how can use the URL value in my ASP code.. I am having trouble doing this

    ??????


    any ideas ????
    <marquee>thanks</marquee>

  • #2
    JPM
    JPM is offline
    Regular Coder
    Join Date
    Mar 2004
    Location
    Norway
    Posts
    204
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I dont know to much ASP, but I think you would have to pass the javascript var value to a (hidden)form field, and then call the the forms submit method and use Request.Form in your ASP code...
    <JPM />

  • #3
    Regular Coder
    Join Date
    Aug 2002
    Location
    Texas
    Posts
    287
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, the ASP operates Server-side, the javascript operates client-side.
    If the javascript sets the value of some form field, i must post back to the server before the ASP is aware of it...


    fv

  • #4
    Regular Coder
    Join Date
    Jul 2002
    Location
    Brighton, UK
    Posts
    282
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hello.. I have decided to take the option of setting the values using javascript cookies. then retrieving them from another page using ASP looping somehow.. but i have a new problem. on my web page i have about 100 products and want the values of the product code stored in a location.. the problem is i am running the script from flash and can't post from the page I am on because i am using levels in flash and these will be lost.. so I needed another way.

    the problem I am having it setting cookies so they count up.. ie

    OrderCookie1 = "code 32"
    OrderCookie2 = "code 88"
    OrderCookie3 = "code 56"

    the way i thought i could do it is .. set 10 cookies with a value of null then when i add a product code it will say ordercookie1 has a value set cookie ordercookie2 to the product code..

    i have tried this.. but no luck

    function products(NAME,URL) {

    if(GetCookie('OrderCookie') == null){
    document.cookie = "OrderCookie" + "=" + URL
    }
    else if(GetCookie('OrderCookie1') == null) {
    document.cookie = "OrderCookie1" + "=" + URL
    }
    window.alert(NAME + " added to order form")
    }

    has anyone have any ideas how I can do this... once the values are in i can use asp to do the rest on another page.. but this is the bit going wrong

    <marquee>thanks</marquee>

  • #5
    Regular Coder
    Join Date
    Jul 2002
    Location
    Brighton, UK
    Posts
    282
    Thanks
    1
    Thanked 0 Times in 0 Posts

    problem solved

    i came up with the answer.. thought I would tell you how I did it.. it may help someone else one day.. i put anll my values onto one cookie.. i took the cookie value and added the new value broken up with a comma..

    then in my asp file i did replaced the comma with a <br>

    hope this may help someone


    thanks asp forum,
    <marquee>thanks</marquee>


  •  

    Posting Permissions

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