JavaScript¾«´â¶ÁÊé±Ê¼Ç(7)
http://blog.csdn.net/mouyong/archive/2010/01/31/5275562.aspx
µÚ7Õ ÕýÔò±í´ïʽ
JavaScriptµÄÐí¶àÌØÐÔ¶¼½è¼ø×ÔÆäËûÓïÑÔ¡£Óï·¨½è¼ø×ÔJava£¬º¯Êý½è¼ø×ÔScheme£¬ÔÐͼ̳нè¼ø×ÔSelf¡£¶øJavaScriptµÄÕýÔò±í´ïʽÌØÐÔÔò½è¼ø×ÔPerl¡£
ÕýÔò±í´ïʽÆðÔ´ÓÚ¶ÔÐÎʽÓïÑÔµÄÊýѧÑо¿¡£
ÔÚJavaScriptÖУ¬ÕýÔò±í´ïʽµÄÓï·¨ÊǶÔPerl°æµÄ¸Ä½øºÍ·¢Õ¹£¬Ëü·Ç³£½Ó½üÔ´×Ô±´¶ûʵÑéÊÒµÄÔʼÐÎʽ¡£ÕýÔò±í´ïʽµÄÊéд¹æÔò³öÆæµÄ¸´ÔÓ£¬ÒòΪËüÃÇ°ÑijЩλÖÃÉϵÄ×Ö·û´®½âÎöΪÔËËã·û£¬¶ø°Ñ½öÔÚλÖÃÉÏÉÔ΢²»Í¬µÄÏàͬ×Ö·û´®ÓÖµ±×÷×Ö·û´®±¾Éí¡£±È²»Ò×Êéд¸üÔã¸âµÄÊÇ£¬ÕâʹµÃÕýÔò±í´ïʽ²»½öÄÑÒÔÔĶÁ£¬¶øÇÒÐÞ¸Äʱ³äÂúΣÏÕ¡£ÒªÏëÕýÈ·µØÔĶÁËüÃÇ£¬¾Í±ØÐë¶ÔÕýÔò±í´ïʽµÄÕû¸ö¸´ÔÓÐÔÓÐÏ൱³¹µ×µÄÀí½â¡£ÎªÁË»º½âÕâ¸öÎÊÌ⣬ÎÒ¶ÔÆä¹æÔò½øÐÐÁËЩÐí¼ò»¯¡£ÕâÀïËùչʾµÄÕýÔò±í´ïʽ¿ÉÄÜÉÔ΢ÓÐЩ²»¹»¼ò½à£¬µ«Ò²»áÈÃÕýÈ·µØʹÓÃËüÃDZäµÃÉÔ΢ÈÝÒ×Ò»µã¡£
ÓеãÈÃÈ˸е½·Ñ½âµÄÊÇ£¬JavaScriptµÄÕýÔò±í´ïʽÄÑÒÔ·Ö¶ÎÔĶÁ£¬ÒòΪËüÃDz»Ö§³Ö×¢ÊͺͿհס£ÕýÔò±í´ïʽµÄËùÓв¿·Ö¶¼±»½ôÃÜÅÅÁÐÔÚÒ»Æð£¬Ê¹µÃËüÃǼ¸ºõÎÞ·¨±»±æÈÏ¡£µ±ËüÃÇÔÚ°²È«Ó¦ÓÃÖнøÐÐɨÃèºÍÑé֤ʱ£¬Õâµã¾ÍÐëÒªÌرðµØÁôÒâ¡£Èç¹ûÄã²»ÄÜÔĶÁºÍÀí½âÒ»¸öÕýÔò±í´ïʽ£¬ÄãÈçºÎÄÜÈ·±£Ëü¶ÔËùÓеÄÊäÈ붼ÄÜÕýÈ·µØ¹¤×÷ÄØ£¿È»¶ø£¬¾¡¹ÜÓÐÕâЩÃ÷ÏÔµÄȱµã£¬µ«ÕýÔò±í´ïʽ»¹ÊDZ»¹ã·ºµØʹÓÃ×Å¡£
7.1 Ò»¸öÀý×Ó
ÕâÀïÓÐÒ»¸öÀý×Ó¡£ËüÊÇÒ»¸öÓÃÀ´Æ¥ÅäURLµÄÕýÔò±í´ïʽ¡£ÔÚJavaScript³ÌÐòÖУ¬ÕýÔò±í´ïʽ±ØÐëдÔÚÒ»ÐÐÖС£ÕýÔò±í´ïʽÖеĿհ×ÊÇÖÁ¹ØÖØÒªµÄ£º
var parse_url=/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/;
var url="http://www.ora.com:80/goodparts?q#fragment";
ÈÃÎÒÃÇÀ´µ÷ÓÃparse_urlµÄexec·½·¨¡£Èç¹ûÄܳɹ¦µØÆ¥ÅäÎÒÃÇ´«¸øËüµÄ×Ö·û´®£¬Ëü½«»á·µ»ØÒ»¸öÊý×飬¸ÃÊý×é°üº¬ÁË´ÓÕâ¸öurlÖÐÌáÈ¡³öÀ´µÄƬ¶Î£º
var result=parse_url.exec(url);
var names=['url','scheme','slash','host','port','path','query','hash'];
var blanks=' ';
var i;
for(i=0;i<names.length;i+=1){
document.writeln('<br />'+names[i]+':'+blanks.substring(names[i].length),result[i]);
Ïà¹ØÎĵµ£º
JavaScript ¿ÉËãÊÇÊÀ½çÉÏ×îÁ÷Ðеıà³ÌÓïÑÔ£¬ËüÔø±» Web ¿ª·¢Éè¼ÆʦÌùÉÏجÃεıêÇ©£¬ËäÈ»ÕæÕýµÄجÃÎÆäʵÊÇ DOM API£¬Õâ¸ö±»´óÁ¿µÄ¿ª·¢ÓëÉè¼ÆʦËæÊÖÄéÀ´ÔöÇ¿ËûÃÇµÄ Web Ç°¶ËµÄ½Å±¾ÓïÑÔ£¬Èç½ñÔ½À´Ô½±»ÖØÊÓ£¬ËäÔòÈç´Ë£¬JavaScript ÈÔȻӵÓкܶàÈÃÈ˷ѽâµÄ¶«Î÷¡£
1. ËüÒÔ Java ÃüÃû£¬µ«²¢²»ÊÇ Java
Ëü×î³õ½Ð Mocha£¬ ½ÓןÄÃûÎ ......
ECMA ±¾ÖÜÍƳöÁË JavaScript 5£¨PDF£©£¬³ýÁËÔöÇ¿»ù´¡º¯Êý¿âÖ®Í⣬»¹ÒýÈëÁËÑϸñÔËÐÐʱģʽ£¨Strict Runtime Modes£©ÒÔ±ÜÃâ´úÂëÖеij£¼û´íÎó¡£ECMA ECMAScript 4 µÄŬÁ¦ÔøÒÔʧ°Ü¸æÖÕ£¬ECMA ÉõÖÁûÓз¢²¼ ECMAScript 4 ϸÔò¡£
¹ýÈ¥¼¸Ä꣬ÖîÈç Nitro£¬TraceMonkey Ò»ÀàµÄ JavaScript ÒýÇ淢չѸÃÍ£¬JavaScript ³ÉÁË Google Wav ......
0. Ç°ÑÔ
ËùνIEµØÖ·À¸±í´ïʽ£¬¾ÍÊÇÔÚIEµÄµØÖ·À¸ÖÐÊäÈë javascript:<´úÂë>£¬Ö´ÐÐijЩ¹¦ÄÜ£¬À´¶¯Ì¬¸Ä±äÔÓÐÒ³ÃæµÄ²ÎÊýÒԴﵽijЩĿµÄ£¬ÀýÈ翪·Å±»½ûÖ¹µÄ°´Å¥¡¢ÏÔʾԱ¾Òþ²ØµÄͼƬµÈµÈ¡£±¾ÎĽ«¾ÍIEµØÖ·À¸µÄʹÓ÷½·¨×öÒ»¸öÏêϸµÄ˵Ã÷¡£
1. ±í´ïʽµÄÊéд·½·¨
ÔÚIEµÄµØÖ·À¸ÖÐÊäÈë javascript:<´úÂë>£¬¼´¿ÉÔÚµ±Ç° ......
ÔÚ¿´Ò»Ð©js¿ò¼ÜµÄ½Å±¾Ê±£¬±»Ò»¸öÎÊÌâºÝºÝµÄÀ§ÈÅ×Å£¬¾ÍÊÇÏÂÃæµÄ´úÂëÊÇʲôÒâ˼
var KE = {};
KE.version = '3.4.1';
KE.lang = {
source : 'Çл»Ä£Ê½',
undo : 'ºóÍË(Ctrl+Z)',
redo : 'Ç°½ø(Ctrl+Y)',
cut : '¼ôÇÐ(Ctrl+X)',
copy : '¸´ÖÆ(Ctrl+C)',
paste : 'Õ³Ìù(Ctrl+V)'
......