JavaScript Reference/Javascript Properties/cookie — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 08:22, 26 мая 2010
Содержание
"cookie" Example
<html>
<body>
<script language="JavaScript">
myDate = new Date("12/22/2005 12:00 AM");
document.cookie = "firstName=Joe;
expires=" + myDate.toString + ";";
</script>
<button onclick="alert(document.cookie);">See Document Cookie</button>
</body>
</html>
"cookie" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |document |
+----------------+--------------------------------------------------------------+
"cookie" Possible Values
Possible Values
A cookie can contain the following name-value pairs:
expires = (date),
domain = (domain name),
path = (usually the current directory)
secure = (only secure environments can access the cookie).
"cookie" Syntax and Note
Note:
Read and write property.
Sets the cookie value.
Syntax:
document.cookie = value