passing asp string value to client side javascript
passing asp string value to client side javascript
am 11.09.2007 17:14:19 von Brendan
I have the following asp page in which I need to generate images
filenames from asp variables and pass these to the client side
javascript that will animate the images. The code below does not work.
How do I pass the filenames to the ajvascript. The code below does not
do it and I do not understand why.
<%
dim zulu, zone, field, depth, image_base_name, image_name(4),
zulu = Request.QueryString("zulu")
zone = Request.QueryString("zone")
field = Request.QueryString("field")
depth = Request.QueryString("depth")
if depth = "nodepth" then
image_base_name = "upload/" & zulu & "_" & zone & "_" & field & "_"
else
image_base_name = "upload/" & zulu & "_" & zone & "_" & field & "_"
& depth & "_"
end if
image_name(0) = image_base_name & "000H" & ".png"
image_name(1) = image_base_name & "012H" & ".png"
image_name(2) = image_base_name & "024H" & ".png"
image_name(3) = image_base_name & "036H" & ".png"
image_name(4) = image_base_name & "048H" & ".png"
%>
Re: passing asp string value to client side javascript
am 11.09.2007 17:35:17 von reb01501
Brendan wrote:
> I have the following asp page in which I need to generate images
> filenames from asp variables and pass these to the client side
> javascript that will animate the images. The code below does not work.
> How do I pass the filenames to the ajvascript. The code below does not
> do it and I do not understand why.
>
> TabImagesComplete[0] = <=%image_name(0)%>;
> TabImagesComplete[1] = <=%image_name(1)%>;
> TabImagesComplete[2] = <=%image_name(2)%>;
> TabImagesComplete[3] = <=%image_name(3)%>;
> TabImagesComplete[4] = <=%image_name(4)%>;
>
1. How do you know that it's not? Have you Viewed Source to verify that
the strings don't appear in the response?
2. It would probably help to delimit these strings:
TabImagesComplete[0] = '<=%image_name(0)%>';
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Re: passing asp string value to client side javascript
am 11.09.2007 18:02:52 von Brendan
Thanks for your reply. Seems to be a problem with having asp code in
the head of the page. At least, when I delete the asp from the head,
the page loads. Dammit....
Re: passing asp string value to client side javascript
am 11.09.2007 18:04:17 von Brendan
On Sep 11, 1:02 pm, Brendan wrote:
> Thanks for your reply. Seems to be a problem with having asp code in
> the head of the page. At least, when I delete the asp from the head,
> the page loads. Dammit....
Oops. Missed a trailing comma.... :( Stewpid me.
Re: passing asp string value to client side javascript
am 11.09.2007 18:09:57 von Tim Slattery
Brendan wrote:
>TabImagesComplete[0] = <=%image_name(0)%>;
Shouldn't this be:
TabImagesComplete[0] = <%=image_name(0)%>;
--
Tim Slattery
MS MVP(DTS)
Slattery_T@bls.gov
http://members.cox.net/slatteryt
Re: passing asp string value to client side javascript
am 11.09.2007 18:48:41 von Brendan
Yes. Thanks. It works now.
Re: passing asp string value to client side javascript
am 11.09.2007 20:34:41 von exjxw.hannivoort
Tim Slattery wrote on 11 sep 2007 in
microsoft.public.inetserver.asp.general:
> Brendan wrote:
>
>
>>TabImagesComplete[0] = <=%image_name(0)%>;
>
> Shouldn't this be:
>
> TabImagesComplete[0] = <%=image_name(0)%>;
Only if you want to assign a number.
If you want to assign a string, do:
TabImagesComplete[0] = '<%=image_name(0)%>';
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)