...

View Full Version : combine asp with javascript



chris_angell
07-28-2004, 06:22 PM
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 javascript:products('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 ????

JPM
07-28-2004, 07:56 PM
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...

fractalvibes
07-28-2004, 11:36 PM
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

chris_angell
07-29-2004, 03:52 PM
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

:eek:

chris_angell
08-03-2004, 09:27 PM
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,



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum