-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJscookie2.html
More file actions
41 lines (36 loc) · 1.19 KB
/
Copy pathJscookie2.html
File metadata and controls
41 lines (36 loc) · 1.19 KB
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
40
41
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<input type="Button" value="setCookie" onclick="setCookie()">
<input type="Button" value="getCookie" onclick="getCookie()">
<input type="Button" value="deleteCookie" onclick="deleteCookie()">
<script>
function setCookie(){
// document.cookie="uname=harendra; expires=Sun, 20 Aug 2000 12:00:00 UTC";
// document.cookie="uname=harendra; max-age=0";
document.cookie="uname=harendra";
cookie1=document.cookie;
}
function getCookie(){
if(document.cookie!=0){
//
var arry=document.cookie.split("=");
alert("Name ="+arry[0]+"Value ="+arry[1]);
}else{
alert('no cookie set');
}
}
function deleteCookie(){
document.cookie=cookie1+"max-age=0"
cookie1=document.cookie;
alert("cookie is deleted");
}
</script>
</body>
</html>