• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 903
  • Last Modified:

Session Timeout

All,

I have a question:

I have this page to handel timeouts:


<SCRIPT LANGUAGE="VBScript">
<!--
     Dim intTimerID
     min=30          'change minutes
     sec=0          'change seconds
     
     Sub HandleTime
     if min=0 and sec=0 then
          endtime
     elseif min=28 and sec>0 then
          sec=sec-1
          min=min-1
          sec=59
          status=hr & ":" & min & ":" & sec
          intTimerID=setTimeOut("HandleTime",950, "VBScript")
        SessionAlert
     elseif min>=0 and sec>0 then
          sec=sec-1
          status=hr & ":" & min & ":" & sec
          intTimerID=setTimeOut("HandleTime",950, "VBScript")
     elseif min>0 and sec=0  then
          min=min-1
          sec=59
          status=hr & ":" & min & ":" & sec
          intTimerID=setTimeOut("HandleTime",950, "VBScript")
     End Sub
     
     Sub endtime
          cleartimeout intTimerID
             status = "Your Time Ended"      
          msgbox "Time Up"    
     end sub

      Sub SessionAlert(popmessage, poptime)
         '-- popmessage is the message that will be displayed to the user when the timer expires.
         '-- it should be properly escaped for display in javascript
         '-- poptime is the amount of time (in minutes) that you want the message to be displayed prior to session timeout
         Response.Write "<script language=""JavaScript"" type=""text/javascript"">" & vbCrLf
         Response.Write "setTimeout('alert(\'" & popmessage & "\');'," & (Session.Timeout-poptime) * 60 * 1000 & ");" & vbCrLf
         Response.Write "</script>" & vbCrLf
      End Sub

     status=min & ":" & sec
     intTimerID=setTimeOut("HandleTime",950, "VBScript")
               
-->
</SCRIPT>


My problem is on the line:         Response.Write "<script language=""JavaScript"" type=""text/javascript"">" & vbCrLf
I get this error: A script block cannot be placed inside another script block.


Please help.  I am trying to give a timeout but give the user a warning that they are about to be signed off!

Thanks,
Sporenza

0
sporenza
Asked:
sporenza
1 Solution
 
anthonywjones66Commented:
      Response.Write "<scr" + "ipt language=""JavaScript"" type=""text/javascript"">" & vbCrLf
 

then

       Response.Write "</scr" + "ipt>" & vbCrLf

Anthony.
0
 
davidlars99Commented:
you can alway use single quotes

Response.Write("<script language='JavaScript' type='text/javascript'>" & vbCrLf)

Response.Write("</script>" & vbCrLf)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now