
Passing a value from ASP to the script
While your hidden input box will work, what Alexandre posted will also work. If you would read
his post, you will notice that he is not directly assigning a server side variable to a client
side variable, but doing the equivelent to what you are doing to get the value into the hidden
input - except that he didn't forget the '='. Your
value="<%ASPvariable%>">
should be
value="<%=ASPvariable%>">
Vincent Minden
Quote:
> Absolutely not true. You can't pass server side variables to client side
> script directly.
> You can however store a server side variable in a hidden input box and then
> refer to the variable in script. Hence in the example given below you can
> store the variable like this:
> <input type="hidden" name="myvar" value="<%ASPvariable%>">
> Then refer to it as:
> <script>
> windows.framename.location.href='document.myform.myvar.value';
> </script>
> > Insert an ASP variable directly into the client script, like this:
> > <script>
> > windows.framename.location.href='<%=ASPvariable%>';
> > </script>
> > IF the ASPVariable is set to "page.asp" you'll get on the browser:
> > <script>
> > windows.framename.location.href='page.asp';
> > </script>
> > Alexandre Pinho
> > Portugal
> > > Could you help me? I am new to Jscript, how could I pass in an ASP page,
> a
> > > value to a script.
> > > Page.asp:
> > > <% a bit of ASP
> > > I set a path and store it in a variable that I want to pass to my script
> > > %>
> > > <script>
> > > I get my variable (my path)
> > > and use it in my script
> > > (a script to access the fso object)
> > > <script>
> > > <% redirect in asp to another page%>