Saturday, March 24, 2012

Passing variables between Server scripts and client scripts!

Hi,

I am having difficulty in passing a variable from a server script to a client script. I am looking to take a parameter that is passed into an ASP page from another page and use this parameter in a client side script.Is it possible to do this?? A simplified version of what I want to do is:

<%
Dim Tag
Tag = Request.QueryString("ID")
%>
........

<%Script Language="VBScript">
Dim Tag2
Tag2 = <%=Tag%>
document.write(Tag2)
<Script
Any help greatly appreciated!!1. need quotes around the literal value in client script
2. need to close your Script tag

<%
Dim Tag as String = Request("ID")
%
<Script Language="VBScript">
Dim Tag2
Tag2 = "<%= Tag %>"
document.write(Tag2)
</Script>

Thank you very much!! Works a treat.

0 comments:

Post a Comment