Hi there,
Familiar problem. You think you are assigning the value of one variable to
another, so you don't need quotes. But you are actually assigning a string
literal (based on an ASP variable) to a JavaScript var. Enclose the value
in quotes, and it should work:
var isActive = '<%=session("active")%>';
Beware that JavaScript is case-sensitive. You said your value should
be "no", but you are checking for "No".
HtH
Imar
> This seems like it should be very simple, but i'm doing something
> wrong. I want the variable isActive to bwe the value of the asp
> session object, which should be no.
>
> I get an error that that says 'No' is undefined pointing to the line
> that declares isActive, 'No' being the value of the session object.
>
> Here are a couple of tries:
>
> <script>
> function active() {
> var isActive =<%=session("active")%>
> //also tried var isActive =toString(<%=session("active")%> )
> if (isActive == "No") {
> alert("You have finished the Get Fit on Route 66 program
> and\ncan no longer log exercise
> minutes.\n-----------------------------------------\nYou may view
> your trip log, check recipes, and \nread the great articles in the
> Guidepost.\n-----------------------------------------\nYou may also
> re-register for another trip along Route 66.")
> return false;
> }
> else
> window.location.href = "log_prog.asp"
> }
> </script>
>
>
> thanks