Variable question

H

Hermione

Hi,

In my site I have a ASP page.

I have

dim id

I want when the user click in a link to give the variable id a value
depending on what the user click:

This what I did but it's not working
<a onclick="afficheDescURL(content[2])" href="Cient.htm" <%id="DYN"%>>


Any idea please

Thanks
 
M

Mike Mueller

What you may want to do is to send the id as a query string
so that the next page can use it...

<a onclick="afficheDescURL(content[2])"
href="Cient.htm?abcd" <%id="DYN"%>>

seeings you are sending to an html page, you would use
javascript to pull the query value

<script>
id = location.search.substring(1);
</script>

If you are going to an asp page, change the href
="Cient.htm?abcd" to href="Cient.htm?sid=abcd"
and here is how to read it:
<%
dim id
id = Request.QueryString("sid")
%>

HTH

Mike




message
: Hi,
:
: In my site I have a ASP page.
:
: I have
:
: dim id
:
: I want when the user click in a link to give the variable
id a value
: depending on what the user click:
:
: This what I did but it's not working
: <a onclick="afficheDescURL(content[2])" href="Cient.htm"
<%id="DYN"%>>
:
:
: Any idea please
:
: Thanks
:
 
H

Hermione

Hi mike,

All what I what is give a value to a variable that I use after

thanks
 
M

Mike Mueller

'Page' variables end as soon as the page is closed. You will
need to either pass the info onlong as I stated earlier or
you can use a session variable. The session variable lasts
15 minutes by default.

to store it as a session variable, you can use the following
code:
<%
Session("sID") = id
%>
and to retrieve it

<%
dim id
id = Session("sID")
%>

Mike
*****************************************
message
: Hi mike,
:
: All what I what is give a value to a variable that I use
after
:
: thanks
:
: "Mike Mueller" wrote:
:
: > What you may want to do is to send the id as a query
string
: > so that the next page can use it...
: >
: > <a onclick="afficheDescURL(content[2])"
: > href="Cient.htm?abcd" <%id="DYN"%>>
: >
: > seeings you are sending to an html page, you would use
: > javascript to pull the query value
: >
: > <script>
: > id = location.search.substring(1);
: > </script>
: >
: > If you are going to an asp page, change the href
: > ="Cient.htm?abcd" to href="Cient.htm?sid=abcd"
: > and here is how to read it:
: > <%
: > dim id
: > id = Request.QueryString("sid")
: > %>
: >
: > HTH
: >
: > Mike
: >
: >
: >
: >
: > message
: >
: > : Hi,
: > :
: > : In my site I have a ASP page.
: > :
: > : I have
: > :
: > : dim id
: > :
: > : I want when the user click in a link to give the
variable
: > id a value
: > : depending on what the user click:
: > :
: > : This what I did but it's not working
: > : <a onclick="afficheDescURL(content[2])"
href="Cient.htm"
: > <%id="DYN"%>>
: > :
: > :
: > : Any idea please
: > :
: > : Thanks
: > :
: >
: >
: >
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top