zoukankan      html  css  js  c++  java
  • document.location的属性

    示例html完整路径为:

    http://10.10.3.117:8500/html/ypt/index.html

    alert("document.location.href:"+document.location.href);

    描述:设置或返回主机名和当前URL 的端口号

    结果:http://10.10.3.117:8500/html/ypt/index.html

    alert("document.location.hash:"+document.location.hash);

    描述:设置或返回从井号(#) 开始的URL(锚)

    结果:


    alert("document.location.host:"+document.location.host);

    描述:设置或返回主机名和当前URL的端口号

    结果:10.10.3.117:8500


    alert("document.location.hostname:"+document.location.hostname);

    描述:设置或返回当前URL的主机名

    结果:10.10.3.117


    alert("document.location.pathname:"+document.location.pathname);

    描述:设置或返回当前URL的路径部分

    结果:/html/ypt/index.html


    alert("document.location.port:"+document.location.port);

    描述:设置或返回当前URL的端口号

    结果:8500

  • 相关阅读:
    SDN第一次上机作业
    期末作业验收
    SDN第5次上机作业
    个人作业——软件工程实践总结作业
    SDN第4次上机作业
    SDN第四次作业
    SDN第三次上机作业
    SDN第三次作业
    SDN第二次上机作业
    SDN第二次作业
  • 原文地址:https://www.cnblogs.com/cczhoufeng/p/3824786.html
Copyright © 2011-2022 走看看