js获取地址栏传参

/**
* [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获取地址栏传参的更多相关文章
- JS获取url传参
function GetRequest() { var url = location.search; //获取url中"?"符后的字串 var theRequest = new O ...
- html js获取URL传参
每天学习一点点 编程PDF电子书.视频教程免费下载:http://www.shitanlife.com/code function GetQueryString(name) { var re ...
- [转]JS获取URL传参方法
function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&] ...
- js方法用来获取路径传参上所带的参数
//js方法用来获取路径传参上所带的参数 function GetQueryString(param) { var reg = new RegExp("(^|&)" + p ...
- 【功能代码】---4用JS获取地址栏参数方法
用JS获取地址栏参数方法 // 方法一:采用正则表达式获取地址栏参数:( 强烈推荐,既实用又方便!) function GetQueryString(name) { var reg = new Reg ...
- (转)用JS获取地址栏参数的方法(超级简单)
转自http://www.cnblogs.com/fishtreeyu/archive/2011/02/27/1966178.html 用JS获取地址栏参数的方法(超级简单) 方法一:采用正则表达式获 ...
- 【JS】---4用JS获取地址栏参数方法
用JS获取地址栏参数方法 // 方法一:采用正则表达式获取地址栏参数:( 强烈推荐,既实用又方便!) function GetQueryString(name) { var reg = new Reg ...
- 怎么通过js获取上传的图片信息(临时保存路径,名称,大小)然后通过ajax传递给后端?
今天在论坛上看到这样一个问题,有必要编辑搜集下. 问题描述:怎么通过js获取上传的图片信息(临时保存路径,名称,大小)然后通过ajax传递给后端 题主用jquery接收 <input name= ...
- js获取上传文件内容(未完待续)
js 获取上传文件的字节数及内容 <div> 上传文件 : <input type="file" name = "file" id = &qu ...
随机推荐
- http://www.layui.com/doc/modules/laydate.html实时通信\日期、==插件
8520**ali chengyouli http://www.layui.com/doc/modules/laydate.html实时通信\日期.==插件
- High Availability手册(2): 架构
最底层是通信层corosync/openais 负责cluster中node之间的通信 上一层是Resource Allocation Layer,包含下面的组件: CRM Cluster Resou ...
- 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 ...
- [Swift]LeetCode37. 解数独 | Sudoku Solver
Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy ...
- [Swift]LeetCode169. 求众数 | Majority Element
Given an array of size n, find the majority element. The majority element is the element that appear ...
- [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 ...
- [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), ...
- json对象和json字符串
Javascript字符串与JSON字符串的最大区别在于,JSON字符串必须使用双引号(单引号会导致语法错误) 与Javascript的对象字面量相比,JSON对象有两个地方不一样.首先,没有声明变量 ...
- ASP.NET Core 系列目录
目录: ASP.NET Core 2.0 : 一. 概述 ASP.NET Core 2.0:二. 开发环境 ASP.NET Core 2.0 : 三. 项目结构 ASP.NET Core 2.0 : ...
- 【转】关于 python ImportError: No module named 的问题
今天在 centos 下安装 python setup.py install 时报错:ImportError: No module named sysconfig, 当时急着用,就顺手直接源码编译了一 ...