You are on page 1of 1

<html>

<head>
<title> COOKIES ARE NOT BISCUIT </title>
<script>
function createcookie(){
with(document.myforms){
document.cookie = "name=" +createcookie1.value ;
alert("cookie Created")

}
}
function showcookie(){
value = document.cookie.split("=")[1];
if(value!=0){
document.write("<br> Cookie = "+value);

}
else{
document.write("Cookie Not Found")
}
}
function deletecookie(){
expirydate = new Date();
expirydate.setmonth(expirydate.getmonth() - 1);
with(document.myforms){
document.cookie = "username=" + createcookie1.value;
document.cookie ="expires" + expirydate.toUTCString();
alert("cookie Is Deleted");
}
}
</script>
</head>
<form name="myforms">
NAME : <input type="text" name="createcookie1" placeholders="Enter Your
Name " />
<input type="button" value="createcookie" onclick="createcookie()" />
<input type="button" value="displaycookie" onclick="showcookie()" />
<input type="button" value="delete" onclick="deletecookie()" />
</form>
</html>

You might also like