zoukankan      html  css  js  c++  java
  • javascript中window.location.search的用法和作用。

    用该属性获取页面 URL 地址:

    window.location 对象所包含的属性

    属性描述
    hash 从井号 (#) 开始的 URL(锚)
    host 主机名和当前 URL 的端口号
    hostname 当前 URL 的主机名
    href 完整的 URL
    pathname 当前 URL 的路径部分
    port 当前 URL 的端口号
    protocol 当前 URL 的协议
    search 从问号 (?) 开始的 URL(查询部分)

    js脚本捕获页面get请求方式的参数,使用window.location.search直接获得,然后通过split方式结合循环遍历自由组织数据格式。

    var searchURL = window.location.search;  

    searchURL = searchURL.substring(1, searchURL.length);  

    var targetPageId = searchURL.split("&")[0].split("=")[1];  

  • 相关阅读:
    HDU 5444 Elven Postman 二叉排序树
    HDU 5438 Ponds dfs模拟
    Gym
    markdown test
    Gym
    集训回顾
    UVALive
    UVALive
    UVALive
    codeforcres 589 J
  • 原文地址:https://www.cnblogs.com/Nancyegg/p/8268830.html
Copyright © 2011-2022 走看看