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>
  • 相关阅读:
    ubuntu18【合上盖子不休眠】
    linux和windows双系统开机显示 Minimal BASHlike line editingis supported xxxxxx
    Linux下opera不支持h5播放器的解决方法
    linux openjdk路径
    Linux安装redis tar.gz
    dpkg 安装deb文件
    Linux破解Navicat15
    kali设置grub主题
    kali安装git tar.gz
    kali 安装 teamviewer 显示检测到wayland
  • 原文地址:https://www.cnblogs.com/Denny_Yang/p/1961408.html
Copyright © 2011-2022 走看看