-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.html
39 lines (35 loc) · 1.48 KB
/
signup.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<script type = "text/javascript">
<!--
function WriteCookie() {
if( document.signupform.signup.value == "" ) {
alert("Enter some value!");
return;
}
cookievalue = escape(document.signupform.signup.value) + ";";
document.cookie = "username=" +cookievalue;
document.write ("Setting Cookies : " + "username=" + cookievalue );
}
//-->
</script>
<body>
<script>function ReadCookie() {
var allcookies = document.cookie;
document.write ("All Cookies : " + allcookies );
// Get all the cookies pairs in an array
cookiearray = allcookies.split(';');
// Now take key value pair out of this array
for(var i=0; i<cookiearray.length; i++) {
name = cookiearray[i].split('=')[0];
value = cookiearray[i].split('=')[1];
document.write ("Key is : " + name + " and Value is : " + value);
}
}
//-->
</script>
<form name = "signupform" action = "">
Enter name: <input type = "text" name = "signup"/>
<input type = "button" value = "Set Cookie" onclick = "WriteCookie()"/>
<input type = "button" value="Read Cookie" onclick = "ReadCookie()"/>
</form>
</body>
<script></script>