How to execute OnClick with an <a Href

G

GhislainTanguay

Hi everyone. I'm not from Internet word i have some difficulties with
events.

I have a session variable who change the selected language (French or
English) and i try to change this variable when someone click on my anchor.
This is my code
<%

if session("IdVersion")="" THEN
intIdVersion=1
Else
intIdVersion=session("IdVersion")
End if

%>

<script language="JavaScript" type="text/JavaScript">

function GetLangue(intIdVersion)
{
if (intIdVersion ==1)
intIdVersion ==2;
Else
intIdVersion ==1;
return intIdVersion;
}
</script>

<a href="default.asp?IdMenuBande=2&amp;IdVersion=<%=intIdVersion%>"
onclick="javascript:GetLangue(<%intIdVersion%>)"
class="texteBandeHaut"><font color="#990000"><%=strVersion%></font></a>


I liked to return my new version only when a user click on the top menu
where he have the possibility with this two language.

But for now all i received is an error messaor who tell me that there's an
error on the page.
 
M

Mark Schupp

You are missing an "=" and you should not have "javascript:" in the onclick
parameter. Use:

onclick="GetLangue(<=%intIdVersion%>)"

instead of

onclick="javascript:GetLangue(<%intIdVersion%>)"
 

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

Members online

No members online now.

Forum statistics

Threads
474,102
Messages
2,570,646
Members
47,247
Latest member
GabrieleL2

Latest Threads

Top