JS¼¼Êõ

Javascript½Å±¾:Location¶ÔÏó

×ÖºÅ+ ×÷Õߣº À´Ô´£º    2014-11-17 20:00 ÎÒÒªÆÀÂÛ( )

Javascript½Å±¾:Location¶ÔÏó,ÔĶÁJavascript½Å±¾:Location¶ÔÏó,Location ¶ÔÏóÊÇ Window ¶ÔÏóµÄÒ»¸ö²¿·Ö£¬¿Éͨ¹ý window.location ÊôÐÔÀ´·ÃÎÊ¡£¾ÙÀý˵Ï Location ¶ÔÏó µÄÊôÐÔÓë·½·¨hash:ÉèÖûò·µ»Ø´Ó¾®ºÅ (#) ¿ªÊ¼µÄ URL£¨Ãª£© ÍøÖ·:http://www.devdao.com/i

Location ¶ÔÏóÊÇ Window ¶ÔÏóµÄÒ»¸ö²¿·Ö£¬¿Éͨ¹ý window.location ÊôÐÔÀ´·ÃÎÊ¡£
¾ÙÀý˵Ï Location ¶ÔÏó µÄÊôÐÔÓë·½·¨

hash:ÉèÖûò·µ»Ø´Ó¾®ºÅ (#) ¿ªÊ¼µÄ URL£¨Ãª£©
ÍøÖ·:http://www.devdao.com/index.html#head
·µ»Ø:#head
<script type="text/javascript">
document.write(location.pathname);
</script>
 
host:ÉèÖûò·µ»ØÖ÷»úÃûºÍµ±Ç° URL µÄ¶Ë¿ÚºÅ
ÍøÖ·:http://www.devdao.com:3389/index.html
·µ»Ø:www.devdao.com:3389
 
hostname:ÉèÖûò·µ»Øµ±Ç° URL µÄÖ÷»úÃû
ÍøÖ·:http://www.devdao.com:3389/index.html
·µ»Ø:www.devdao.com
 
href:ÉèÖûò·µ»ØÍêÕûµÄ URL
ÍøÖ·:http://www.devdao.com:3389/index.html
·µ»Ø:http://www.devdao.com:3389/index.html
 
pathname:ÉèÖûò·µ»Øµ±Ç° URL µÄ·¾¶²¿·Ö
ÍøÖ·:http://www.devdao.com/index.html#head
·µ»Ø:/index.html
 
port:ÉèÖûò·µ»Øµ±Ç° URL µÄ¶Ë¿ÚºÅ
ÍøÖ·:http://www.devdao.com:3389/index.html
·µ»Ø:3389
 
protocol:ÉèÖûò·µ»Øµ±Ç° URL µÄЭÒé
ÍøÖ·:http://www.devdao.com:3389/index.html
·µ»Ø:http:
 
search:ÉèÖûò·µ»Ø´ÓÎʺŠ(?) ¿ªÊ¼µÄ URL£¨²éѯ²¿·Ö£©¡£
ÍøÖ·:http://www.devdao.com/index.html?id=333
·µ»Ø:?id=333


assign():¼ÓÔØеÄÎĵµ
Óï·¨:window.location.assign(URL)
 
reload():ÖØмÓÔص±Ç°Îĵµ
Óï·¨:window.location.reload()
 
replace():ÓÃеÄÎĵµÌæ»»µ±Ç°Îĵµ
Óï·¨:window.location.replace()

¡¡

1.±¾Õ¾×ñÑ­ÐÐÒµ¹æ·¶£¬ÈκÎתÔصĸå¼þ¶¼»áÃ÷È·±ê×¢×÷ÕߺÍÀ´Ô´£»2.±¾Õ¾µÄÔ­´´ÎÄÕ£¬ÇëתÔØʱÎñ±Ø×¢Ã÷ÎÄÕÂ×÷ÕߺÍÀ´Ô´£¬²»×ðÖØÔ­´´µÄÐÐΪÎÒÃǽ«×·¾¿ÔðÈΣ»3.×÷ÕßͶ¸å¿ÉÄܻᾭÎÒÃDZ༭Ð޸Ļò²¹³ä¡£

Ïà¹ØÎÄÕÂ
  • ѧϰJavaScriptÖ®this,call,apply

    ѧϰJavaScript֮this,call,apply

    2016-01-28 20:45

  • Áã»ù´¡ÈëÃÅѧϰPython£¨10£©£ºº¯Êý - qq_33256568µÄ²©¿Í - ²©¿ÍƵµÀ - CSDN.NET qq_3

    Áã»ù´¡ÈëÃÅѧϰPython£¨10£©£ºº¯Êý - qq_33256568µÄ²©¿Í - ²©¿ÍƵµÀ

    2015-12-15 09:04

  • ¡¾JavaScript.2¡¿±æÎöTypeof²Ù×÷·û×÷Óã¬ÂÞÁÐJSÎå´óÊý¾ÝÀàÐÍÕóÈÝ - Ã϶«»Ô ÀÈ·»Ê¦·¶Ñ§ÔºÐÅÏ¢¼¼ÊõÌá¸ß°à

    ¡¾JavaScript.2¡¿±æÎöTypeof²Ù×÷·û×÷Óã¬ÂÞÁÐJSÎå´óÊý¾ÝÀàÐÍÕóÈÝ -

    2015-12-15 09:00

  • ͼÏñ´¦ÀíÖеÄÊýѧԭÀíÏê½â19¡ª¡ªº¯ÊýµÄ¼«ÏÞ - °×Âí¸º½ðÄרÀ¸ - ²©¿ÍƵµÀ - CSDN.NET °×Âí¸º½ðÄרÀ¸

    ͼÏñ´¦ÀíÖеÄÊýѧԭÀíÏê½â19¡ª¡ªº¯ÊýµÄ¼«ÏÞ - °×Âí¸º½ðÄרÀ¸ - ²©

    2015-12-14 19:00

ÍøÓѵãÆÀ
Ç