You are on page 1of 1

<html>

<head>
<title>
FINAL COOKIE JS
</title>
<script>
function cc(){
with(document.myform){
document.cookie = "username=" + cookiename.value
alert("cookie Created " )
}
}
function rc(){
cookies = document.cookie.split("=")[1]
if(cookies != 0){
document.write("Cookie:" + cookies)
}
else{
alert("Cookie Not Created ")
}

}
function dc(){
document.cookie = "username= Deleted = 01 Jan 1970 00:00:00:
UTC"
alert("Cookie Deleted")
}
</script>

</head>
<body>
<form name="myform" >
NAME : <input type="text" name="cookiename" placeholder="Enter Your
Name" />
<input type="button" value="Create" onclick="cc()" />
<input type="button" value="Read" onclick="rc()" />
<input type="button" value="Delete" onclick="dc()" />

</form>
</body>
</html>

You might also like