前端小白,記錄一下。
以如下URL為例:
http://xuexi.ggsddu.com/index.html?x=1&y=2&z=3
location.href得到的是整個(gè)URL,即http://xuexi.ggsddu.com/index.html?x=1&y=2&z=3
location.search得到的是從?開始的字符串,即?x=1&y=2&z=3
location其實(shí)是一個(gè)對(duì)象,詳見Location 對(duì)象
前端小白,記錄一下。
以如下URL為例:
http://xuexi.ggsddu.com/index.html?x=1&y=2&z=3
location.href得到的是整個(gè)URL,即http://xuexi.ggsddu.com/index.html?x=1&y=2&z=3
location.search得到的是從?開始的字符串,即?x=1&y=2&z=3
location其實(shí)是一個(gè)對(duì)象,詳見Location 對(duì)象