• 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>
  • 相关阅读:
    DS博客作业03--树
    DS博客作业02--栈和队列
    DS博客作业02--线性表
    c博客06-2019-结构体&文件
    C博客作业05--2019-指针
    C语言博客作业04--数组
    c语言博客作业03--函数
    C语言博客作业02--循环结构
    深入理解Java线程池原理
    Offer快到碗里来——聊聊线程池
  • 原文地址:https://www.cnblogs.com/Denny_Yang/p/1961408.html
Copyright © 2020-2023  润新知