Variable

H

Hermione

Hello

I want to add a variable to my web page

When the user click on the link : CATS ---> CAT will be assigned to a
variable
When the user click on the link : DOGS ---> DOG will be assigned to a
variable

After in my web page I have to use this variable.

href = "Animale?A=" ???

I tried to made the follwing

<a img name ="CAT1" href ="/CAT1" onclick="AfficheA(This)" <%Anim="CAT"%>>

But it didn't work

is it possible to do? can I declare a Javascript or ASP variable, assign a
value every time the user click on the link and use it after on my link

thanks
 
R

Ronx

Does this help?

<a href="animale.asp?Animale=cat" onclick="AfficheA(This);"><img
src="cat.jpg" name="cat1"></a>

You cannot assign a value to a server side variable from a client side
action. To assign a JavaScript variable, do it in a function called
by the onclick event.
 
M

MD Websunlimited

What do you wish to do with the variable?

In JavaScript

<a href="javascript: void(0);" onclick="animal = 'cat'" ><img src="cat.jpg" ></a>

To use the selected value in ASP

<a href="" onclick="this.href='amimal.asp?animal=cat'; return true;" ><img src="cat.jpg" ></a>

The latter calls a ASP page animal.asp passing a query string. To access the type of animal in animal.asp

dim animal

animal = request.form("animal")
if len(animal) = 0 then
animal = request.querystring("animal")
if len(animal) = 0 then
response.redirect "sysErr.asp?err=" & server.URLEncode("No animals were selected!")
end if
end if

' do something with an animal.
 
H

Hermione

Hello Mike

In my page I have a menu in the left and a French bottom on the left (all my
pages are ASP)

I want if the user is on the english page and he click on the link Cats and
after he wants to change to the french site he'll click on the French and
Cats_FR.asp will be loaded

Thanks

"MD Websunlimited" a écrit :
 
S

Stefan B Rusynko

If they have open the page Cats from a querystring as in animal.asp?animal=Cats
Then just use the query string to build the URL for the French page
One way is in the page animal.asp make the a querystring value w/ the page link at the top or the page
<% FRpage=Request.QueryString("animal") & "_FR.asp" %>
- will give you a variable of page="Cats_FR.asp"

And for your French link build it as
<a href="<%=FRpage %>">The French <% Request.QueryString("animal"") %> page</a>




| Hello Mike
|
| In my page I have a menu in the left and a French bottom on the left (all my
| pages are ASP)
|
| I want if the user is on the english page and he click on the link Cats and
| after he wants to change to the french site he'll click on the French and
| Cats_FR.asp will be loaded
|
| Thanks
|
| "MD Websunlimited" a écrit :
|
| > What do you wish to do with the variable?
| >
| > In JavaScript
| >
| > <a href="javascript: void(0);" onclick="animal = 'cat'" ><img src="cat.jpg" ></a>
| >
| > To use the selected value in ASP
| >
| > <a href="" onclick="this.href='amimal.asp?animal=cat'; return true;" ><img src="cat.jpg" ></a>
| >
| > The latter calls a ASP page animal.asp passing a query string. To access the type of animal in animal.asp
| >
| > dim animal
| >
| > animal = request.form("animal")
| > if len(animal) = 0 then
| > animal = request.querystring("animal")
| > if len(animal) = 0 then
| > response.redirect "sysErr.asp?err=" & server.URLEncode("No animals were selected!")
| > end if
| > end if
| >
| > ' do something with an animal.
| >
| > --
| > Mike -- FrontPage MVP '97 - '02
| > http://www.websunlimited.com
| > FrontPage Add-ins Summer Promotion -
| > FREE Purchase J-Bots Plus 2004 & receive Meta Tag Maker 2004 a $24.95 value FREE
| >
| >
| > > Hello
| > >
| > > I want to add a variable to my web page
| > >
| > > When the user click on the link : CATS ---> CAT will be assigned to a
| > > variable
| > > When the user click on the link : DOGS ---> DOG will be assigned to a
| > > variable
| > >
| > > After in my web page I have to use this variable.
| > >
| > > href = "Animale?A=" ???
| > >
| > > I tried to made the follwing
| > >
| > > <a img name ="CAT1" href ="/CAT1" onclick="AfficheA(This)" <%Anim="CAT"%>>
| > >
| > > But it didn't work
| > >
| > > is it possible to do? can I declare a Javascript or ASP variable, assign a
| > > value every time the user click on the link and use it after on my link
| > >
| > > 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