Cookies½ÒÃØ [Asp.Net, Javascript]
Ò»£¬Ç°ÑÔ
CookiesÏë±ØËùÓÐÈ˶¼Á˽⣬ µ«ÊÇδ±ØËùÓÐÈ˶¼¾«Í¨¡£±¾ÎĽ²½âÁËCookiesµÄ¸÷·½Ãæ֪ʶ£¬ ²¢ÇÒÌá³öÀ´ÁË×î¼Ñʵ¼ù¡£ÕâÊDZÊÕßÔÚÈÕ³£¹¤×÷ÖеĻýÀۺͳÁµí¡£
¶þ£¬»ù´¡ÖªÊ¶
1.ʲôÊÇCookies
Cookie ÊÇһС¶ÎÎı¾ÐÅÏ¢£¬°éËæ×ÅÓû§ÇëÇóºÍÒ³ÃæÔÚ Web ·þÎñÆ÷ºÍä¯ÀÀÆ÷Ö®¼ä´«µÝ¡£Cookie °üº¬Ã¿´ÎÓû§·ÃÎÊÕ¾µãʱ Web Ó¦ÓóÌÐò¶¼¿ÉÒÔ¶ÁÈ¡µÄÐÅÏ¢¡£
ÀýÈ磬Èç¹ûÔÚÓû§ÇëÇóÕ¾µãÖеÄÒ³ÃæʱӦÓóÌÐò·¢Ë͸ø¸ÃÓû§µÄ²»½ö½öÊÇÒ»¸öÒ³Ã棬»¹ÓÐÒ»¸ö°üº¬ÈÕÆÚºÍʱ¼äµÄ Cookie£¬Óû§µÄä¯ÀÀÆ÷ÔÚ»ñµÃÒ³ÃæµÄͬʱ»¹»ñµÃÁ˸à Cookie£¬²¢½«Ëü´æ´¢ÔÚÓû§Ó²ÅÌÉϵÄij¸öÎļþ¼ÐÖС£
ÒÔºó£¬Èç¹û¸ÃÓû§ÔÙ´ÎÇëÇóÄúÕ¾µãÖеÄÒ³Ã棬µ±¸ÃÓû§ÊäÈë URL ʱ£¬ä¯ÀÀÆ÷±ã»áÔÚ±¾µØÓ²ÅÌÉϲéÕÒÓë¸Ã URL ¹ØÁªµÄ Cookie¡£Èç¹û¸Ã Cookie ´æÔÚ£¬ä¯ÀÀÆ÷±ã½«¸Ã Cookie ÓëÒ³ÇëÇóÒ»Æð·¢Ë͵½ÄúµÄÕ¾µã¡£È»ºó£¬Ó¦ÓóÌÐò±ã¿ÉÒÔÈ·¶¨¸ÃÓû§ÉϴηÃÎÊÕ¾µãµÄÈÕÆÚºÍʱ¼ä¡£Äú¿ÉÒÔʹÓÃÕâЩÐÅÏ¢ÏòÓû§ÏÔʾһÌõÏûÏ¢£¬Ò²¿ÉÒÔ¼ì²éµ½ÆÚÈÕÆÚ¡£
Cookie ÓëÍøÕ¾¹ØÁª£¬¶ø²»ÊÇÓëÌض¨µÄÒ³Ãæ¹ØÁª¡£Òò´Ë£¬ÎÞÂÛÓû§ÇëÇóÕ¾µãÖеÄÄÄÒ»¸öÒ³Ã棬ä¯ÀÀÆ÷ºÍ·þÎñÆ÷¶¼½«½»»» Cookie ÐÅÏ¢¡£Óû§·ÃÎʲ»Í¬Õ¾µãʱ£¬¸÷¸öÕ¾µã¶¼¿ÉÄÜ»áÏòÓû§µÄä¯ÀÀÆ÷·¢ËÍÒ»¸ö Cookie£»ä¯ÀÀÆ÷»á·Ö±ð´æ´¢ËùÓÐ Cookie¡£
Cookie °ïÖúÍøÕ¾´æ´¢ÓйطÃÎÊÕßµÄÐÅÏ¢¡£Ò»°ãÀ´Ëµ£¬Cookie ÊÇÒ»ÖÖ±£³Ö Web Ó¦ÓóÌÐòÁ¬ÐøÐÔ£¨¼´Ö´ÐÐ״̬¹ÜÀí£©µÄ·½·¨¡£³ý¶ÌÔݵÄʵ¼Ê½»»»ÐÅÏ¢µÄʱ¼äÍ⣬ä¯ÀÀÆ÷ºÍ Web ·þÎñÆ÷¼ä¶¼ÊǶϿªÁ¬½ÓµÄ¡£¶ÔÓÚÓû§Ïò Web ·þÎñÆ÷·¢³öµÄÿ¸öÇëÇó£¬Web ·þÎñÆ÷¶¼»áµ¥¶À´¦Àí¡£µ«ÊÇÔںܶàÇé¿öÏ£¬Web ·þÎñÆ÷ÔÚÓû§ÇëÇóҳʱʶ±ð³öÓû§»áÊ®·ÖÓÐÓá£ÀýÈ磬¹ºÎïÕ¾µãÉ쵀 Web ·þÎñÆ÷¸ú×Ùÿλ¹ºÎïÕߣ¬ÕâÑùÕ¾µã¾Í¿ÉÒÔ¹ÜÀí¹ºÎï³µºÍÆäËûµÄÓû§Ìض¨ÐÅÏ¢¡£Òò´Ë£¬Cookie ¿ÉÒÔ×÷ΪһÖÖÃûƬ£¬ÌṩÏà¹ØµÄ±êʶÐÅÏ¢°ïÖúÓ¦ÓóÌÐòÈ·¶¨ÈçºÎ¼ÌÐøÖ´ÐС£
ʹÓà Cookie Äܹ»´ïµ½¶àÖÖÄ¿µÄ£¬ËùÓÐÕâЩĿµÄ¶¼ÊÇΪÁË°ïÖúÍøÕ¾¼ÇסÓû§¡£ÀýÈ磬һ¸öʵʩÃñÒâ²âÑéµÄÕ¾µã¿ÉÒÔ¼òµ¥µØ½« Cookie ×÷Ϊһ¸ö Boolean Öµ£¬ÓÃËüÀ´Ö¸Ê¾Óû§µÄä¯ÀÀÆ÷ÊÇ·ñÒѲÎÓëÁËͶƱ£¬ÕâÑùÓû§±ãÎÞ·¨½øÐеڶþ´ÎͶƱ¡£ÒªÇóÓû§µÇ¼µÄÕ¾µãÔò¿ÉÒÔͨ¹ý Cookie À´¼Ç¼Óû§ÒѾµÇ¼£¬ÕâÑùÓû§¾Í²»±Øÿ´Î¶¼ÊäÈëƾ¾Ý¡£
2.CookiesÈçºÎ´æ´¢
Cookies±£´æÔÚÓû§µÄ±¾µØ»úÆ÷ÉÏ£¬²»Í¬µÄä¯ÀÀÆ÷´æ´¢ÔÚ²»Í¬µÄÎļþ¼ÐÖУ¬²¢ÇÒ°´ÕÕÓòÃû·Ö±ð±£´æ¡£¼´ÍøÕ¾Ö®¼äµÄCookies²»»á±Ë´Ë¸²¸Ç¡£
IEä¯ÀÀÆ÷µÄÓû§¿ÉÒÔͨ¹ýÔÚ±¾µØµÄÎĵµÖÐÕÒµ½CookiesµÄtxtÎļþ£¬ ²»Í¬²
Ïà¹ØÎĵµ£º
±¾ÎÄÖ÷ÒªÊdzöÓÚÓÐÅóÓÑʹÓÃÎÒÔÀ´Ð´µÄautocompleteµÄJS¿Ø¼þ¡£µ±Êý¾ÝÁ¿´óµÄʱºò£¬»á³öÏÖЧÂʼ«ÆäÂýµÄÇé¿ö£¬ÎÒÔÚÕâ¶Îʱ¼ä×ö³öµÄһЩ²âÊÔÒ²¼°Ò»Ð©¾Ñ飬Óë´ó¼Ò·ÖÏí£¬Èç¹ûÓдíµÄµØ·½£¬»¹ÇëÖ¸³ö¡£
¾¹ý²âÊÔ£¬ÎÒÃǻᷢÏÖÈçϵÄÇé¿ö»òÕß˵µÄ½áÂÛ£¬Èç¹ûÄúµÄ²âÊÔ½á¹ûÓëÎҵIJ»·û£¬Çë˵Ã÷ÔÒò£¬ÒÔ±ãÏ໥ѧϰ¡£
1£©µ±Ò»¸ö½Ï´óµÄHTML×Ö· ......
JavaScript »ñȡʼþ¶ÔÏóµÄÒ»¸ö×¢Òâµã
2009-7-24 ÉÏÎç
- JS/Ajax/AS/Flex
- event
- javascript
ƽʱÎÒÃÇ»ñȡʼþ¶ÔÏóÒ»°ãд·¨ÈçÏ£º
function
getEvent
(
event
)
{
return
event
||
window
.
event
// IE:window.event
}
Èç¹ûûÓвÎÊý£¬Ò²¿ ......
page1.htmlΪ¸¸´°¿Ú£¬page2.htmΪ×Ó´°¿Ú¡£Ïêϸ´úÂëÈçÏ£º
page1.html
ÒýÓÃ
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Con ......