Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session Variables

Status
Not open for further replies.
Aug 2, 2002
28
GB
Newbie to ASP. I am setting a session variable as follows

session("location") = "gib1"

This works fines. However, I wish to change this variable when the user clicks a link on the website. I have created a hotspot for the link and have used the onClick behavoiur to move to the new URL, this also swaps an image. As follows:

<area shape=&quot;rect&quot; coords=&quot;2,94,124,118&quot; href=&quot;#&quot; onClick=&quot;MM_goToURL('parent','locationinfocan3.asp');return document.MM_returnValue&quot; onMouseOver=&quot;MM_swapImage('Image2','','destinationmenu-eatingout.gif',1)&quot; onMouseOut=&quot;MM_swapImgRestore()&quot;>

How do i set the new session variable before the new page is displayed.

Thanks.
 
Paul,

Javascript cannot set a Session variable by itself. Javascript is Client side ASP is Server side. You can however, put a URL variable on the link, or add it with Javascript and then the recieving page can set the Session variable from the URL variable. Be careful with your security if you do that. Make sure you validate the contents of the URL variable.

Hope it helps.


Travis Hawkins
BeachBum Software
travis@cfm2asp.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top