zoukankan      html  css  js  c++  java
  • JS获取当前页面路径的相关方法(属性)

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title></title>
    </head>
    <body>
    <table width=100% cellpadding=0 cellspacing=0 border=0 >
    <script language="javascript">
    thisURL = document.URL;
    thisHREF = document.location.href;
    thisSLoc = self.location.href;
    thisDLoc = document.location;
    strwrite = "<tr><td valign=top>thisURL: </td><td>[" + thisURL + "]</td></tr>"
    strwrite += "<tr><td valign=top>thisHREF: </td><td>[" + thisHREF + "]</td></tr>"
    strwrite += "<tr><td valign=top>thisSLoc: </td><td>[" + thisSLoc + "]</td></tr>"
    strwrite += "<tr><td valign=top>thisDLoc: </td><td>[" + thisDLoc + "]</td></tr>"
    document.write( strwrite );
    </script>
    <tr><td colspan="2">
    thisDLoc = document.location; <br />
    thisURL = document.URL;  <br />
    thisHREF = document.location.href;  <br />
    thisSLoc = self.location.href; <br />
    </td></tr>
    <script language="javascript">
    thisTLoc = top.location.href;
    thisPLoc = parent.document.location;
    thisTHost = top.location.hostname;
    thisHost = location.hostname;
    strwrite = "<tr><td valign=top>thisTLoc: </td><td>[" + thisTLoc + "]</td></tr>"
    strwrite += "<tr><td valign=top>thisPLoc: </td><td>[" + thisPLoc + "]</td></tr>"
    strwrite += "<tr><td valign=top>thisTHost: </td><td>[" + thisTHost + "]</td></tr>"
    strwrite += "<tr><td valign=top>thisHost: </td><td>[" + thisHost + "]</td></tr>"
    document.write( strwrite );
    </script>
    <tr><td colspan="2">
    thisTLoc = top.location.href;  <br />
    thisPLoc = parent.document.location;  <br />
    thisTHost = top.location.hostname;  <br />
    thisHost = location.hostname; <br />
    </td></tr>
    <script language="javascript">
    tmpHPage = thisHREF.split( "/" );
    thisHPage = tmpHPage[ tmpHPage.length-1 ];
    tmpUPage = thisURL.split( "/" );
    thisUPage = tmpUPage[ tmpUPage.length-1 ];
    strwrite = "<tr><td valign=top>thisHPage: </td><td>[" + thisHPage + "]</td></tr>"
    strwrite += "<tr><td valign=top>thisUPage: </td><td>[" + thisUPage + "]</td></tr>"
    document.write( strwrite );
    </script>
    </table>
    </body>
    </html>
  • 相关阅读:
    MySQL插入数据慢解决办法
    java的 System.currentTimeMillis() 与时区
    单元测试断言系统 类似于 生活中如何说话
    IDEA、Eclipse 默认常用快捷键对比总结,visual studio快捷键总结
    使用过的正则匹配的例子
    filters的this问题
    vuex的使用
    offset/scroll/clien系列知识点
    promise对象的理解
    语义化标签的理解
  • 原文地址:https://www.cnblogs.com/Denny_Yang/p/1961408.html
Copyright © 2011-2022 走看看