国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > JavaScript > 正文

js獲取當(dāng)前路徑的簡(jiǎn)單示例代碼

2019-11-20 21:17:41
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

<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()

可以得到自己的網(wǎng)絡(luò)地址:request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getRequestURI()

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 确山县| 韶山市| 闽侯县| 即墨市| 吐鲁番市| 呈贡县| 都匀市| 肇东市| 莱西市| 绥江县| 平乡县| 盐亭县| 韩城市| 德昌县| 盐津县| 深圳市| 岑溪市| 镇安县| 高要市| 长治市| 宁德市| 怀柔区| 顺义区| 乐都县| 嘉义县| 青州市| 龙江县| 岳普湖县| 西城区| 潞城市| 湘乡市| 亚东县| 舒城县| 阿尔山市| 张家界市| 屏南县| 永年县| 阳城县| 繁峙县| 嘉义市| 桂林市|