Forum Moderators: open

Message Too Old, No Replies

how to code for login logout using javascript instead of asp

         

stumped

5:51 pm on Oct 4, 2009 (gmt 0)

10+ Year Member



How do you use Javascript to identify if the person viewing the page is logged in or not and swap a login or logout button?

I am building a site on a hosted shopping cart that used to allow access to the root asp files whereby I used the following code:
<%If Session("www.myd/AccessKey") = "" then%>
<a href="https://www.mydomain.com/login.asp" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('LOGIN','','//www.mydomain.com/photos/template/menu-buttons/login01.png',1)"><img src="//www.mydomain.com/photos/template/menu-buttons/login02.png" alt="LOGIN" name="LOGIN" width="47" height="19" border="0"></a>
<%else%>
<a href="https://www.mydomain.com/login.asp?logout=yes" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('LOGOUT','','//www.mydomain.com/photos/template/menu-buttons/logout01.png',1)"><img src="//www.mydomain.com/photos/template/menu-buttons/logout02.png" alt="LOGOUT" name="LOGOUT" width="60" height="19" border="0"></a>
<%end if%>

Now the host has upgraded and no longer allows access to the root directory except for css and a single html template. The rule is that html, css, and javascript are what can be used to customize.

I know enough to find asp code and modify it but I am lost when it comes to Javascript.

Can anyone help?

stumped

6:44 pm on Oct 4, 2009 (gmt 0)

10+ Year Member



I checked the server variables and Request.Cookies("CustomerID") works to check for login or not, I just do not know how to do it in Javascript