Click to See Complete Forum and Search --> : Problem with creating a function


Burt
09-23-2003, 09:48 AM
Hi,

I need some help with the following code.
I use this code to get information from a database:

var strScale = "<%=rstClients("strPhoto_A_scale")%>"

As you can see I use some ASP-code within this construction.
Actually it is working fine, but I want to create a function for this code because I need it several times.

This is what I want:

var strRequest = "strPhoto_A_scale"
var strScale = "<%=rstClients(strRequest)%>"
fncGetDatabaseInfo(strScale)

Well, this doesn't work. I receive an ADO-error (item not found in collection).

Can you help me to construct the right syntax for this function?

Kind regards,
Burt

Khalid Ali
09-23-2003, 10:45 AM
are you trying to create variable in JavaScript and then passing it to the ASP?

if yes then it will not work.
you will have to decalre variable on ASP side and use it.
you can only directly pass values from ASP to JavaScript not the other way around.

Burt
09-23-2003, 11:27 AM
Hi,

In my opinion I'm not trying to pass a value from Javascript to ASP or the other way around, but I might be wrong here.

I'll try to explane some more.

This is what I want:
var strRequest = "strPhoto_A_scale"

so strRequest really contains the text "strPhoto_A_scale".

Then I try to pass this value to the next code:

var strScale = "<%=rstClients(strRequest)%>".

So I expect strScale really contains this:
var strScale = "<%=rstClients("strPhoto_A_scale")%>".

But that is not the case.
So acually I try the pass a value to the next line of code.
I hope you understand what I try to explane.

Kind regards,
Burt