72
Programming Languages for mis
9 UserName = ""
10 // If the cookie is not empty, then retrieve the cookie
11 if (document.cookie != "") {
12 UserName = document.cookie.split("=")[1]
-11 }
13 // If the NameBox is not empty then obtain the user name from the box
14 if (document.CustomerForm.NameBox != "") {
15 UserName = document.CustomerForm.NameBox.value
-14 }
16 // Write cookie
17 document.cookie = "UserName=" + UserName + ";expires="
18 + expireDate.toGMTString()
-8 }
-4 </SCRIPT>
-2 </HEAD>
19 <BODY>
20 <H3>Customer relationships: </H3>
21 <FORM NAME=CustomerForm>
22 Please enter your name for cookie:
23 <INPUT TYPE=TEXT NAME=NameBox onBlur="WriteCookie()">
-21 </FORM>
24 <P>After you close the Web page, please visit
25 (ReadCookie.html) ...