Try the code below. This is a demo from a MS web site. It can be used on asp or htm web pages. Rgds, Nic.<br><br><br><br><HTML><br><HEAD><br></HEAD><br><br><SCRIPT LANGUAGE="VBScript"><br><!--<br><br> '****************************************************************<br> 'Dimension and set the NOT_FOUND constant for the entire page <br> Dim NOT_FOUND<br> NOT_FOUND = "NOT_FOUND"<br><br> '****************************************************************<br> ' Purpose: Creates or modifies the value assigned to a given<br> ' variable.<br> ' Inputs: strVariableName: The name of the variable that will<br> ' have its value set.<br> ' varVariableValue: The value that strVariableName<br> ' should be set to.<br> ' Returns: Nothing<br> ' Notes: This function could be expanded to include other<br> ' cookie attributes, such as expire date and valid<br> ' domains. Cookies set with this implementation expire<br> ' at the end of the user's session. If the cookie<br> ' should remain valid for a longer period of time,<br> ' an expires section can be added to the string. For<br> ' example:<br> ' ... & varVariableName & ";expires=01-Jul-96 GMT"<br><br> '****************************************************************<br><br> Sub SetVariable(strVariableName, varVariableValue)<br> Document.Cookie = strVariableName & "=" & varVariableValue<br> End Sub<br><br><br> '****************************************************************<br> ' Purpose: Delete the variable with the name held in<br> ' strVariableName<br> ' Inputs: strVariableName: The name of the variable to delete <br> ' Returns: Nothing<br> ' Notes: The cookie is deleted by setting the expires attribute<br> ' to a date that has already occurred. If one went back<br> ' time, this method would break, so be sure to take that<br> ' into account.<br> '****************************************************************<br><br> Sub KillVariable(strVariableName)<br> SetVariable strVariableName, "NULL;expires=Monday, 01-Jan-95 12:00:00 GMT"<br> End Sub<br><br> '****************************************************************<br> ' Purpose: Finds and returns the value of of the variable with<br> ' the name held in strVariableName<br> ' Inputs: strVariableName: The name of the variable to return<br> ' the value of.<br> ' Returns: The value of the variable with the name of<br> ' strVariableName.<br> ' If the variable is not found, returns NOT_FOUND.<br> ' Notes: This function could be greatly simplified if the<br> ' bounds-checking code was removed.<br> ' The NOT_FOUND constant should be set<br> ' once for the entire page.<br> '****************************************************************<br><br> Function ReadVariable(strVariableName)<br> 'these five variables are used in the string manipulation<br> 'code that finds the variable in the cookie.<br> Dim intLocation<br> Dim intNameLength<br> Dim intValueLength<br> Dim intNextSemicolon<br> Dim strTemp<br><br> 'calculate length and location of variable name<br> intNameLength = Len(strVariableName)<br> intLocation = Instr(Document.Cookie, strVariableName)<br> <br> 'check for existence of variable name <br> If intLocation = 0 Then<br> 'variable not found, so it can't be read<br> ReadVariable = NOT_FOUND<br> Else<br> 'get a smaller substring to work with<br> strTemp = Right(Document.Cookie, Len(Document.Cookie) - intLocation + 1)<br><br> 'check to make sure we found the full string, not just a substring<br> If Mid(strTemp, intNameLength + 1, 1) <> "=" Then<br> 'oops, only found substring, not good enough<br> ReadVariable = NOT_FOUND<br><br> 'note that this will incorrectly give a not found result if and only if<br> 'a search for a variable whose name is a substring of a preceding<br> 'variable is undertaken. For example, this will fail:<br> '<br> 'search for: MyVar<br> 'cookie contains: MyVariable=2;MyVar=1<br> Else<br> 'found full string<br> intNextSemicolon = Instr(strTemp, ";"

<br><br> 'if not found, then we need the last element of the cookie<br> If intNextSemicolon = 0 Then intNextSemicolon = Len(strTemp) + 1<br> <br> 'check for empty variable (Var1=

<br> If intNextSemicolon = (intNameLength + 2) Then<br> 'variable is empty<br> ReadVariable = ""<br> Else<br> 'calculate value normally<br> intValueLength = intNextSemicolon - intNameLength - 2<br> ReadVariable = Mid(strTemp, intNameLength + 2, intValueLength)<br> End If<br> End If<br> End if<br> End Function<br><br>' ***********************************************<br>' Code behind buttons<br>' ***********************************************<br><br> Sub btnSaveVariable_onClick<br> Dim strVariableName<br> Dim varVariableValue<br><br> strVariableName = InputBox("Enter variable name"

<br> varVariableValue = InputBox("Enter value for '" & strVariableName & "'"

<br> <br> SetVariable strVariableName, varVariableValue<br> End Sub <br><br> Sub btnReadVariable_onClick<br> Dim strVariableName<br> Dim varVariableValue<br> <br> strVariableName = InputBox("Enter variable name to read"

<br> varVariableValue = ReadVariable(strVariableName)<br><br> If varVariableValue = NOT_FOUND Then<br> MsgBox "'" & strVariableName & "' not found."<br> Else<br> MsgBox "'" & strVariableName & "' has a value of '" & varVariableValue & "'."<br> End If<br> End sub<br><br> Sub btnShowCookie_onClick<br> MsgBox Document.Cookie<br> End Sub<br><br> Sub btnNextPage_onClick<br> Location.HRef = "extcookie2.htm"<br> End Sub<br><br> Sub btnKillVariable_onClick<br> Dim strVariableName<br> Dim varVariableValue<br> <br> strVariableName = InputBox("Enter variable name to delete"

<br> varVariableValue = ReadVariable(strVariableName)<br><br> If varVariableValue = NOT_FOUND Then<br> MsgBox "'" & strVariableName & "' not found."<br> Else<br> KillVariable(strVariableName)<br> MsgBox "Variable deleted."<br> End If<br> End Sub<br> <br>--><br></SCRIPT><br><br><table><br><br><TD VALIGN=TOP BGCOLOR="#FFFFFF" width="759"><br><br><FONT FACE="verdana, arial, helvetica" SIZE=2><br><P><br><form Name="Form1" action=""><br><INPUT TYPE="BUTTON" NAME="btnSaveVariable" VALUE="Save Variable"><br><INPUT TYPE="BUTTON" NAME="btnReadVariable" VALUE="Read Variable"><br><INPUT TYPE="BUTTON" NAME="btnKillVariable" VALUE="Kill Variable"><br><INPUT TYPE="BUTTON" NAME="btnShowCookie" VALUE="Show Cookie"><br><INPUT TYPE="BUTTON" NAME="btnNextPage" VALUE="Next Page"><br></FORM><br><p><br></TR><br><br></TABLE><br><br></FONT><br>