asptoday_discuss thread: onclick event with <a> tag
Message #1 by "Tan Chye Ting" <chyeting18@h...> on Thu, 31 Jan 2002 12:21:38
|
|
is it possible to create a session variable after a <a> tag is click
some thing like this
<a href=test.asp onclick=<%session("Name")= rsTest("Name")%>></a>
is there something wrong with the sintac..please correct it ..thank you
Message #2 by "Greg Jennings" <greg.jennings@t...> on Thu, 31 Jan 2002 15:06:58
|
|
That script executes at the server before the client ever sees the page.
It is possible to run some scripts at the client, but I don't think you
can use ASP objects at the client.
One solution would be to create the link with the value that you want.
<a href=test.asp?Name=<%=rsTest("Name")%>>Link</a>
Then, in Test.asp, you can do this:
<%Session("Name") = Request.QueryString("Name")%>
> is it possible to create a session variable after a <a> tag is click
>
> some thing like this
>
> <a href=test.asp onclick=<%session("Name")= rsTest("Name")%>></a>
> is there something wrong with the sintac..please correct it ..thank you
Message #3 by "Dmitry Zakharov" <brook74@h...> on Thu, 31 Jan 2002 16:39:45
|
|
Step 1 (HTML)
<a href = "javascript:doSessionAdd(m_myVar)"...
Step 2 (JScript) - use the same page as you are at
function doSessionAdd(myVar){
//
document.location = "Page.aspx?myVar=" + myVar
}
Step 3 (ASP)
<%
if len(Request.QueryString("myVar"))<>0
Session("slvMyVariable") = Request.QueryString("myVar")
end if
%>
That's it...
If You still have qurstions please write at email....
Cheers.
|