没有合适的资源?快使用搜索试试~ 我知道了~
JS获取当前页面完整信息,获取页面的头信息
资源推荐
资源详情
资源评论
1.获取当前完整网址
<script type="text/javascript">
var thisURL = document.URL;
var thisHREF = document.location.href;
var thisSLoc = self.location.href;
var thisDLoc = document.location;
strwrite = " thisURL: [" + thisURL + "]<br />"
strwrite += " thisHREF: [" + thisHREF + "]<br />"
strwrite += " thisSLoc: [" + thisSLoc + "]<br />"
strwrite += " thisDLoc: [" + thisDLoc + "]<br />"
document.write( strwrite );
</script>
2.获取当前域名信息
<script type="text/javascript">
var thisTLoc = top.location.href;
var thisPLoc = parent.document.location;
var thisTHost = top.location.hostname;
var thisHost = location.hostname;
strwrite = " thisTLoc: [" + thisTLoc + "]<br />"
strwrite += " thisPLoc: [" + thisPLoc + "]<br />"
strwrite += " thisTHost: [" + thisTHost + "]<br />"
strwrite += " thisHost: [" + thisHost + "]<br />"
document.write( strwrite );
</script>
3.获取当前页面
<script type="text/javascript">
var tmpHPage = thisHREF.split( "/" );
var thisHPage = tmpHPage[ tmpHPage.length-1 ];
<script type="text/javascript">
var thisURL = document.URL;
var thisHREF = document.location.href;
var thisSLoc = self.location.href;
var thisDLoc = document.location;
strwrite = " thisURL: [" + thisURL + "]<br />"
strwrite += " thisHREF: [" + thisHREF + "]<br />"
strwrite += " thisSLoc: [" + thisSLoc + "]<br />"
strwrite += " thisDLoc: [" + thisDLoc + "]<br />"
document.write( strwrite );
</script>
2.获取当前域名信息
<script type="text/javascript">
var thisTLoc = top.location.href;
var thisPLoc = parent.document.location;
var thisTHost = top.location.hostname;
var thisHost = location.hostname;
strwrite = " thisTLoc: [" + thisTLoc + "]<br />"
strwrite += " thisPLoc: [" + thisPLoc + "]<br />"
strwrite += " thisTHost: [" + thisTHost + "]<br />"
strwrite += " thisHost: [" + thisHost + "]<br />"
document.write( strwrite );
</script>
3.获取当前页面
<script type="text/javascript">
var tmpHPage = thisHREF.split( "/" );
var thisHPage = tmpHPage[ tmpHPage.length-1 ];
资源评论
chujun2046
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功