location對(duì)象屬性
如下代碼:
<script type="text/javascript">
??? var host=window.location.host;
?? //var hash1=window.location.hash;
?? var hostname=window.location.hostname;
?? var href= window.location.href;
?? var pathname=window.location.pathname;
?? var port1=window.location.port;
?? var protocol=window.location.protocol;
?? //var search=window.location.search;
??? document.write("主機(jī)名和當(dāng)前URL的端口號(hào):"+host+"<br/>"+"錨點(diǎn):"+"<br/>"+"主機(jī)名:"+hostname+"<br/>"+"完整的URL:"+href+"<br/>"+"當(dāng)前URL的路徑部分為:"+pathname+"<br/>"+"端口號(hào):"+port1+"<br/>"+"當(dāng)前URL協(xié)議"+protocol+"<br/>")
?</script>
為什么hash,port,search這三個(gè)對(duì)象的屬性不能夠顯示出來(lái)?如果我的代碼格式錯(cuò)誤,那么請(qǐng)問(wèn)對(duì)的代碼格式是什么?
謝謝你的回答
2015-11-03
設(shè)個(gè)斷點(diǎn)不就看到 window.location的所有屬性了