HTML and CSS Reference
In-Depth Information
EXAMPLE 16.4 ( CONTINUED )
3
function seeCookie() {
if(document.cookie == ""){
alert("No cookies");
return false;
}
else{
4
var myCookie = document.cookie.split("; ");
if ( i < myCookie.length ){
5
document.form1.cookietype.value =
myCookie[i].split("=")[0];
i++; // Increase the index value
// to see the next cookie
}
else{alert("No more cookies");}
}
}
</script>
</head>
6
<body onLoad="seeCookie()" >
<div align="center">
<h2> Got milk?</h2>
7
<form name="form1">
Is this the cookie you want to delete?
<br />
<input type="text" name="cookietype" >
<p>
8
<input type="radio"
name="radio"
value="choice"
9
onClick=
"delCookie(document.form1.cookietype.value);" />Yes
<input type="radio"
name="radio"
value="choice"
10
onClick="seeCookie();" />No
</p>
</form>
</div>
</body>
</html>
EXPLANATION
1
The function called delCookie() will remove a requested cookie. The name of the
cookie, cookieName , is passed as a parameter to the function.
Continues
Search WWH ::




Custom Search