地址:http://127.0.0.1:8082/prosperleedir/index.html?id=6666&name=prosper#prosper
        Location{
            assign:ƒ (),                                                                            // 加载新的文档。
            hash:"#prosper",                                                                        // 设置或返回从井号 (#) 开始的 URL(锚)。
            host:"127.0.0.1:8082",                                                                  // 设置或返回主机名和当前 URL 的端口号。
            hostname:"127.0.0.1",                                                                   // 设置或返回当前 URL 的主机名。
            href:"http://127.0.0.1:8082/prosperleedir/index.html?id=6666&name=prosper#prosper",     // 设置或返回完整的 URL。
            origin:"http://127.0.0.1:8082",                                                         // 返回当前 URL 的协议和主机名和当前 URL 的端口号。
            pathname:"/prosperleedir/index.html",                                                   // 设置或返回当前 URL 的路径部分。
            port:"8082",                                                                            // 设置或返回当前 URL 的端口号。
            protocol:"http:",                                                                       // 设置或返回当前 URL 的协议。
            reload:ƒ reload(),                                                                      // 重新加载当前文档。
            replace:ƒ (),                                                                           // 用新的文档替换当前文档。
            search:"?id=6666&name=prosper",                                                         // 设置或返回从问号 (?) 开始的 URL(查询部分)。
            toString:ƒ toString(),                                                                  // 返回完整的 URL。
        }
        加载新的文档。
        window.location.assign("http://www.baidu.com");
        用新的文档替换当前文档。
        window.location.replace("http://www.baidu.com");
        重新加载当前文档。
        如果该方法没有规定参数,或者参数是 false,它就会用 HTTP 头 If-Modified-Since 来检测服务器上的文档是否已改变。如果文档已改变,reload() 会再次下载该文档。如果文档未改变,则该方法将从缓存中装载文档。这与用户单击浏览器的刷新按钮的效果是完全一样的。
        如果把该方法的参数设置为 true,那么无论文档的最后修改日期是什么,它都会绕过缓存,从服务器上重新下载该文档。这与用户在单击浏览器的刷新按钮时按住 Shift 健的效果是完全一样。
        window.location.reload(true);
        window.location.reload(false);
        返回完整的 URL。
        console.log(window.location.toString());

         /**
* [getUrlParam 获取地址栏传参]
* @param {[String]} paramname [参数名]
* @return {[String]} [参数值]
*/
function getUrlParam(paramname) { var reg = new RegExp("(^|&)" + paramname + "=([^&]*)(&|$)"); // 查询匹配 substr(1)删除? match()匹配
var s = window.location.search.substr(1).match(reg); if (s != null) { return unescape(s[2]); // unescape() 函数可对通过 escape() 编码的字符串进行解码。 } return null; } // ?id=6666&name=prosper
getUrlParam('id'); // s的输出为["id=6666&","","6666","&"]
getUrlParam('name'); // s的输出为["name=prosper","&","prosper",""]

js获取地址栏传参的更多相关文章

  1. JS获取url传参

    function GetRequest() { var url = location.search; //获取url中"?"符后的字串 var theRequest = new O ...

  2. html js获取URL传参

    每天学习一点点 编程PDF电子书.视频教程免费下载:http://www.shitanlife.com/code function GetQueryString(name) {      var re ...

  3. [转]JS获取URL传参方法

    function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&] ...

  4. js方法用来获取路径传参上所带的参数

    //js方法用来获取路径传参上所带的参数 function GetQueryString(param) { var reg = new RegExp("(^|&)" + p ...

  5. 【功能代码】---4用JS获取地址栏参数方法

    用JS获取地址栏参数方法 // 方法一:采用正则表达式获取地址栏参数:( 强烈推荐,既实用又方便!) function GetQueryString(name) { var reg = new Reg ...

  6. (转)用JS获取地址栏参数的方法(超级简单)

    转自http://www.cnblogs.com/fishtreeyu/archive/2011/02/27/1966178.html 用JS获取地址栏参数的方法(超级简单) 方法一:采用正则表达式获 ...

  7. 【JS】---4用JS获取地址栏参数方法

    用JS获取地址栏参数方法 // 方法一:采用正则表达式获取地址栏参数:( 强烈推荐,既实用又方便!) function GetQueryString(name) { var reg = new Reg ...

  8. 怎么通过js获取上传的图片信息(临时保存路径,名称,大小)然后通过ajax传递给后端?

    今天在论坛上看到这样一个问题,有必要编辑搜集下. 问题描述:怎么通过js获取上传的图片信息(临时保存路径,名称,大小)然后通过ajax传递给后端 题主用jquery接收 <input name= ...

  9. js获取上传文件内容(未完待续)

    js 获取上传文件的字节数及内容 <div> 上传文件 : <input type="file" name = "file" id = &qu ...

随机推荐

  1. http://www.layui.com/doc/modules/laydate.html实时通信\日期、==插件

    8520**ali chengyouli http://www.layui.com/doc/modules/laydate.html实时通信\日期.==插件

  2. High Availability手册(2): 架构

    最底层是通信层corosync/openais 负责cluster中node之间的通信 上一层是Resource Allocation Layer,包含下面的组件: CRM Cluster Resou ...

  3. 1.6 Why only in China?

    Android plug-in is in full swing in China, why is it silent in foreign countries? The applications o ...

  4. [Swift]LeetCode37. 解数独 | Sudoku Solver

    Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy  ...

  5. [Swift]LeetCode169. 求众数 | Majority Element

    Given an array of size n, find the majority element. The majority element is the element that appear ...

  6. [Swift]LeetCode186. 翻转字符串中的单词 II $ Reverse Words in a String II

    Given an input string, reverse the string word by word. A word is defined as a sequence of non-space ...

  7. [Swift]LeetCode926. 将字符串翻转到单调递增 | Flip String to Monotone Increasing

    A string of '0's and '1's is monotone increasing if it consists of some number of '0's (possibly 0), ...

  8. json对象和json字符串

    Javascript字符串与JSON字符串的最大区别在于,JSON字符串必须使用双引号(单引号会导致语法错误) 与Javascript的对象字面量相比,JSON对象有两个地方不一样.首先,没有声明变量 ...

  9. ASP.NET Core 系列目录

    目录: ASP.NET Core 2.0 : 一. 概述 ASP.NET Core 2.0:二. 开发环境 ASP.NET Core 2.0 : 三. 项目结构 ASP.NET Core 2.0 : ...

  10. 【转】关于 python ImportError: No module named 的问题

    今天在 centos 下安装 python setup.py install 时报错:ImportError: No module named sysconfig, 当时急着用,就顺手直接源码编译了一 ...