js代码:
<script language="javascript">
//获取域名
host1 = window.location.host;
host2=document.domain;
//获取页面完整地址
host3= window.location.href;
document.write("<br>host1="+host1)
document.write("<br>host2="+host2)
document.write("<br>host3="+host3)
</script>
输入结果:
host=localhost
host2=localhost
url=http://localhost/test/wlphp.html