加入收藏 | 设为首页 | 会员中心 | 我要投稿 聊城站长网 (https://www.0635zz.com/)- 智能语音交互、行业智能、AI应用、云计算、5G!
当前位置: 首页 > 教程 > 正文

js获取当前进程的简单例子代码

发布时间:2023-09-14 15:08:53 所属栏目:教程 来源:
导读:<script type="text/javascript">

thisURL = document.URL;

thisHREF = document.location.href;

thisSLoc = self.location.href;

thisDLoc = document.location;

strwrite = " thisURL: ["
<script type="text/javascript">   
 
thisURL = document.URL;
 
thisHREF = document.location.href;
 
thisSLoc = self.location.href;
 
thisDLoc = document.location;
 
strwrite = " thisURL: [" + thisURL + "]<br />"
 
strwrite += " thisHREF: [" + thisHREF + "]<br />"
 
strwrite += " thisSLoc: [" + thisSLoc + "]<br />"
 
strwrite += " thisDLoc: [" + thisDLoc + "]<br />"
 
document.write( strwrite );
 
thisTLoc = top.location.href;
 
thisPLoc = parent.document.location;
 
thisTHost = top.location.hostname;
 
thisHost = location.hostname;
 
strwrite = " thisTLoc: [" + thisTLoc + "]<br />"
 
strwrite += " thisPLoc: [" + thisPLoc + "]<br />"
 
strwrite += " thisTHost: [" + thisTHost + "]<br />"
 
strwrite += " thisHost: [" + thisHost + "]<br />"
 
document.write( strwrite );
 
tmpHPage = thisHREF.split( "/" );
 
thisHPage = tmpHPage[ tmpHPage.length-1 ];
 
tmpUPage = thisURL.split( "/" );
 
thisUPage = tmpUPage[ tmpUPage.length-1 ];
 
strwrite = " thisHPage: [" + thisHPage + "]<br />"
 
strwrite += " thisUPage: [" + thisUPage + "]<br />"
 
document.write( strwrite );
 
var url="<%=request.getRequestURI()%>";
 
alert(url)
 
</script>
 
request.getRequestURI();
 
request.getRequestURL();
 
request.getQueryString();
 
request.getServletPath()
 
可以得到自己的网络地址:request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getRequestURI()
 
 
 

(编辑:聊城站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章