Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JavaScriptµÄCookies

ʹÓà Cookies¡¡¡¡ÎÒÃÇÒѾ­ÖªµÀ£¬ÔÚ document ¶ÔÏóÖÐÓÐÒ»¸ö cookie ÊôÐÔ¡£µ«ÊÇ Cookie ÓÖÊÇʲô£¿“ijЩ Web
Õ¾µãÔÚÄúµÄÓ²ÅÌÉÏÓúÜСµÄÎı¾Îļþ´æ´¢ÁËһЩÐÅÏ¢£¬ÕâЩÎļþ¾Í³ÆΪ Cookie¡£”—— MSIE °ïÖú¡£Ò»°ãÀ´Ëµ£¬Cookies ÊÇ CGI
»òÀàËÆ£¬±È HTML ¸ß¼¶µÄÎļþ¡¢³ÌÐòµÈ´´½¨µÄ£¬µ«ÊÇ JavaScript Ò²ÌṩÁË¶Ô Cookies µÄºÜÈ«ÃæµÄ·ÃÎÊȨÀû¡£
¡¡¡¡ÔÚ¼ÌÐø֮ǰ£¬ÎÒÃÇÏÈҪѧһѧ Cookie µÄ»ù±¾ÖªÊ¶
¡£
¡¡¡¡Ã¿¸ö Cookie ¶¼ÊÇÕâÑùµÄ£º<cookieÃû>=<Öµ>
¡¡¡¡<cookieÃû>µÄÏÞÖÆÓë JavaScript µÄÃüÃûÏÞÖÆ´óͬСÒ죬ÉÙÁË“²»ÄÜÓà JavaScript
¹Ø¼ü×Ö”£¬¶àÁË“Ö»ÄÜÓÿÉÒÔÓÃÔÚ URL
±àÂëÖеÄ×Ö·û”¡£ºóÕ߱ȽÏÄѶ®£¬µ«ÊÇÖ»ÒªÄãÖ»ÓÃ×ÖĸºÍÊý×ÖÃüÃû£¬¾ÍÍêȫûÓÐÎÊÌâÁË¡£<Öµ>µÄÒªÇóÒ²ÊÇ“Ö»ÄÜÓÿÉÒÔÓÃÔÚ URL
±àÂëÖеÄ×Ö·û”¡£
¡¡¡¡Ã¿¸ö Cookie ¶¼ÓÐʧЧÈÕÆÚ£¬Ò»µ©µçÄÔµÄʱÖÓ¹ýÁËʧЧÈÕÆÚ£¬Õâ¸ö Cookie ¾Í»á±»É¾µô¡£ÎÒÃDz»ÄÜÖ±½ÓɾµôÒ»¸ö Cookie£¬µ«ÊÇ¿ÉÒÔÓÃÉ趨ʧЧÈÕÆÚÔçÓÚÏÖÔÚʱ¿ÌµÄ·½·¨À´¼ä½ÓɾµôËü¡£
¡¡¡¡Ã¿¸öÍøÒ³£¬»òÕß˵ÿ¸öÕ¾µã£¬¶¼ÓÐËü×Ô¼ºµÄ Cookies£¬ÕâЩ Cookies
Ö»ÄÜÓÉÕâ¸öÕ¾µãϵÄÍøÒ³À´·ÃÎÊ£¬À´×ÔÆäËûÕ¾µã»òͬһվµãÏÂδ¾­ÊÚȨµÄÇøÓòµÄÍøÒ³£¬ÊDz»ÄÜ·ÃÎʵġ£Ã¿Ò»“×é”Cookies Óй涨µÄ×Ü´óС£¨´óÔ¼
2KB ÿ“×锣©£¬Ò»³¬¹ý×î´ó×Ü´óС£¬Ôò×îÔçʧЧµÄ Cookie Ïȱ»É¾³ý£¬À´ÈÃÐ嵀 Cookie“°²¼Ò”¡£
¡¡¡¡ÏÖÔÚÎÒÃÇÀ´Ñ§Ï°Ê¹Óà document.cookie ÊôÐÔ
¡£
¡¡¡¡Èç¹ûÖ±½ÓʹÓà document.cookie ÊôÐÔ£¬»òÕß˵£¬ÓÃijÖÖ·½·¨£¬ÀýÈç¸ø±äÁ¿¸³Öµ£¬À´»ñµÃ document.cookie
µÄÖµ£¬ÎÒÃǾͿÉÒÔÖªµÀÔÚÏÖÔÚµÄÎĵµÖÐÓжàÉÙ¸ö Cookies£¬Ã¿¸ö Cookies
µÄÃû×Ö£¬ºÍËüµÄÖµ¡£ÀýÈ磬ÔÚijÎĵµÖÐÌí¼Ó“document.write(document.cookie)”£¬½á¹ûÏÔʾ£º
name=kevin; email=kevin@kevin.com; lastvisited=index.html
ÕâÒâζ×Å£¬Îĵµ°üº¬ 3 ¸ö Cookies£ºname, email ºÍ lastvisited£¬ËüÃǵÄÖµ·Ö±ðÊÇ kevin, kevin@kevin.com
ºÍ index.html¡£¿ÉÒÔ¿´µ½£¬Á½¸ö Cookies Ö®¼äÊÇÓ÷ֺźͿոñ¸ô¿ªµÄ£¬ÓÚÊÇÎÒÃÇ¿ÉÒÔÓà cookieString.split(';
') ·½·¨µÃµ½Ã¿¸ö Cookie ·Ö¿ªµÄÒ»¸öÊý×飨ÏÈÓà var cookieString = document.cookie£©¡£
¡¡¡¡É趨һ¸ö Cookie µÄ·½·¨ÊÇ¶Ô document.cookie ¸³Öµ¡£ÓëÆäËüÇé¿öϵĸ³Öµ²»Í¬£¬Ïò document.cookie ¸³Öµ²»»áɾ³ýµôÔ­ÓÐµÄ Cookies


Ïà¹ØÎĵµ£º

FFºÍIEÖ®¼ä7¸öJavaScriptµÄ²îÒì

¾¡¹Ü JavaScript ÀúÊ·ÉÏʹÓÃÈß³¤¶øÁîÈËÉúÑáµÄ´úÂë¿éÀ´±êµÄÌض¨ä¯ÀÀÆ÷µÄʱÆÚÒѾ­½áÊøÁË£¬µ«ÊÇż¶ûʹÓÃһЩ¼òµ¥µÄ´úÂë¿éºÍ¶ÔÏó¼ì²âÀ´È·±£Ò»Ð©´úÂëÔÚÓû§»úÆ÷ÉÏÕý³£¹¤×÷ÒÀÈ»ÊDZØÒªµÄ¡£
ÕâƪÎÄÕÂÖУ¬ÎÒ»áÂÔÊöһϠInternet Explorer ºÍ Firefox ÔÚ JavaScript Óï·¨Éϲ»Í¬µÄ 7 ¸ö·½Ãæ¡£
1. CSS “float” ÊôÐÔ
»ñÈ¡ ......

javascript λÖÃÇø±ð


ÔÚÄÄÀï·ÅÖÃ JavaScript
Ò³ÃæÖеĽű¾»áÔÚÒ³ÃæÔØÈëä¯ÀÀÆ÷ºóÁ¢¼´Ö´ÐС£ÎÒÃDz¢²»×ÜÏ£ÍûÕâÑù¡£ÓÐʱ£¬ÎÒÃÇÏ£Íûµ±Ò³ÃæÔØÈëʱִÐнű¾£¬¶øÁíÍâµÄʱºò£¬ÎÒÃÇÔòÏ£Íûµ±Óû§´¥·¢Ê¼þʱ²ÅÖ´Ðнű¾¡£
λÓÚ head ²¿·ÖµÄ½Å±¾£º
µ±½Å±¾±»µ÷ÓÃʱ£¬»òÕßµ±Ê¼þ±»´¥·¢Ê±£¬½Å±¾¾Í»á±»Ö´ÐС£µ±Äã°Ñ½Å±¾·ÅÖõ½ head ²¿·Öºó£¬¾Í¿ÉÒÔÈ·±£ÔÚÐèÒªÊ ......

ÈýÖÖ²»Í¬Î»ÖõÄJavaScript´úÂëµÄд·¨

¿Í»§¶Ë½Å±¾JavaScriptÔÚд·¨ÉÏÆäʵÓкܶàÖÖ·½·¨£¬ËüÃǵķÅÖÃλÖÃÒ²·Ç³£Ö®¶à¡£¡£
ÏÂÃæÁоÙÔÚÈýÖÖ²»Í¬µÄµØ·½Ð´JavaScript´úÂ룬ʵÏÖµÄЧ¹û¶¼Êǵã»÷°´Å¥buttonµ¯³öalert¾¯¸æ¿ò
µÚÒ»ÖÖÊÇ×î³£¼ûµÄ£¬´úÂëÈçÏÂ
html´úÂë
<input type="button" value="°´Å¥1" id="btn1" onclick="pop()">
js´úÂë
f ......

javaScriptʱ¼äº¯Êý

var today = new Date();
·µ»Øµ±Ç°µÄÈÕÆÚºÍʱ¼ä
var newyear = new Date("December 31, 1998 23:59:59");
ÊäÈëµÄÊÇ±íµ¥µÄ×Ö·û´® “Ô ÈÕ£¬Äê Сʱ£º·ÖÖÓ£ºÃë”
var bday = new Date(75, 1, 16);
²ÎÊýÊÇÄê·Ý£¬Ô£¬ÈÕ
var bday = new Date(75, 1, 16, 12, 0, 0);
²ÎÊýÊÇÄê·Ý£¬Ô£¬ÈÕ£¬Ð¡Ê±£¬·ÖÖÓ£¬Ãë
Õ ......

JavaScriptÖÐifÓëcase±È½Ï

·¢ÏÖ×Ô¼º´úÂëÖÐÓÃifµÄµØ·½±È½Ï¶à£¬ÓÚÊǾÍÔÚÉÏÖܶÔcaseÓï¾äºÃºÃÑо¿ÁËÒ»·¬²¢ÓÅ»¯ÁË×Ô¼ºµÄ²¿·Ö´úÂë¡£Òò´Ë³öÏÖÁËÈçÏÂifºÍcaseµÄ±È½Ïһ˵¡£ÉùÃ÷µ±caseµÄÌõ¼þ¿éÖÐûÓÃbreakʱºò£¬ÊǺÍifÒ»ÑùµÄÒ»¸öÒ»¸öµÄÌõ¼þÀ´ÅжÏÖ´ÐС£µ±Ìõ¼þÖÐÓÐÁËbreak£¬±àÒëÆ÷»áΪËü×ö¶þ·Ö·¨ÓÅ»¯(»òÌøת±í)£¬¾ÍÊǸù¾ÝÌõ¼þÀ´Ìøת£¬Æ½¾ùÐÔÄܸßÓÚif¡£
¶¨Ò壺 d ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ