Forum Moderators: open

Message Too Old, No Replies

can i use javascript instead of asp to check a cookie variable?

Convert asp to Javascript for server cookie variable

         

stumped

7:41 am on Nov 7, 2009 (gmt 0)

10+ Year Member



<%
Sub TestAsp
temp = Request.Cookies("CustomerID")
if temp = "" then
Response.Write "You are not logged in <br />"
else
Response.Write "You are logged in with CustomerID " & temp & "<br />"
end if
End Sub
TestAsp
%>

Can the above be translated into Javascript?

Fotiman

4:39 pm on Nov 9, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yes, you can access cookies via JavaScript. If you want a simplified interface for working with Cookies, check out the Yahoo UI Library's Cookie Utility [developer.yahoo.com]. Otherwise, W3Schools has a JavaScript tutorial that includes a section for working with Cookies [w3schools.com].

stumped

5:29 pm on Nov 9, 2009 (gmt 0)

10+ Year Member



Thanks, the W3schools link is exactly what I needed.