zoukankan      html  css  js  c++  java
  • location对象属性

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>location对象属性</title>
        <!-- 
            host        设置或返回主机名和当前 URL 的端口号。
            hash        设置或返回从井号 (#) 开始的 URL(锚)。
            href        设置或返回完整的 URL。
            hostname    设置或返回当前 URL 的主机名。
            port        设置或返回当前 URL 的端口号。
            pathname    设置或返回当前 URL 的路径部分。
            search        设置或返回从问号 (?) 开始的 URL(查询部分)。
            protocol    设置或返回当前 URL 的协议。
         -->
    </head>
    <body>
        <input type="button" id="inp" value="点击">
        <script>
            console.log(location.host);//主机名和端口号
            console.log(location.hash="#inp");//锚(#)后面的url
            console.log(location.href);//完整url
            console.log(location.hostname);//主机名
            console.log(location.port);//端口号
            console.log(location.pathname);//url的路径部分
            console.log(location.search="?id=10");//问号(?)后面的url
            console.log(location.protocol);//url协议
        </script>
    </body>
    </html>
  • 相关阅读:
    uwsgi
    protobuf c++ API
    memcached 第二篇----安装使用
    ice grid配置使用第二篇------实际使用
    ICE BOX 配置,使用----第一篇
    可视化资料收集
    Protocol Buffers
    ice grid 完整部署过程
    django组件之ajax
    关于Django在写小项目的一些小注意事项
  • 原文地址:https://www.cnblogs.com/vinson-blog/p/12077422.html
Copyright © 2011-2022 走看看