Definition and Usage..
The cookie property sets or returns all name/value pairs of cookies in the current document.
Syntax:
Return the cookie property: document.cookie
CODING:The cookie property sets or returns all name/value pairs of cookies in the current document.
Syntax:
Return the cookie property: document.cookie
<!DOCTYPE html>
<html>
<body>
<p>Click the button to get the cookies associated with the current document.</p>
<button onclick="CookiesDisp()">Display Cookies</button>
<p id="demo"></p>
<script>
function Cookiesdisp() {
var x = document.cookie;
document.getElementById("demo").innerHTML = "Cookies associated with this document: " + x;
}
</script>
</body>
</html>
<html>
<body>
<p>Click the button to get the cookies associated with the current document.</p>
<button onclick="CookiesDisp()">Display Cookies</button>
<p id="demo"></p>
<script>
function Cookiesdisp() {
var x = document.cookie;
document.getElementById("demo").innerHTML = "Cookies associated with this document: " + x;
}
</script>
</body>
</html>
Comments
Post a Comment