JS 获取当前域名,url

  <script language="javascript">

//获取域名

host = window.location.host;

host2=document.domain; 

 

//获取页面完整地址

url = window.location.href;

 

document.write("<br>host="+host)

document.write("<br>host2="+host2)

document.write("<br>url="+url)

</script>

posted @ 2015-04-23 11:13  mrt_yy  阅读(276)  评论(0编辑  收藏  举报