JavaScript 取得網址資訊

<script type="text/javascript">    //http://www.Name.com.tw/index.aspx      
  document.write("location.href : "+location.href+"<br/>");    
  document.write("location.protocol : "+location.protocol+"<br/>");    
  document.write("location.hostname : "+location.hostname+"<br/>");    
  document.write("location.host : "+location.host+"<br/>");    
  document.write("location.port : "+location.port+"<br/>");    
  document.write("location.pathname : "+location.pathname+"<br/>");    
  document.write("location.search : "+location.search+"<br/>");    
  document.write("location.hash : "+location.hash+"<br/>");
</script>




顯示:
location.href :http://www.name.com.tw/
location.protocol : http
location.hostname : functionlab.org
location.host : functionlab.org:80
location.port : 80
location.pathname : /index.aspx
location.search : ?user=FUNction
location.hash : #showscript

留言

這個網誌中的熱門文章

delivery note和delivery order的區別和翻譯

Eclipse 3.6.1 Helios 中文化方法

牙技專業英文--技工篇