location.search在客户端获取Url参数的方法

location.search是从当前URL的?号开始的字符串
如:http://www.baidu.com/s?wd=baidu&cl=3
它的search就是?wd=baidu&cl=3

如: location.search.substr(1).split("&")[0]

可以返回第一个参数:wd=baidu

如: location.search.split('?')[1]
可以返回所有参数:wd=baidu&cl=3

jquery知识location.search的更多相关文章

  1. 【知识】location.search获取中文时候会被编码成一串字符

    [转码] 例如:case.html?id='这个是页面的标题' 当想要使用location.search获取?id='这个是页面的标题'的时候,包含的中文会被编码成一串字符串. 所以我们需要进行解码, ...

  2. 如何快速获取当前链接?后面的内容,location.search、页面滚动

    function request() { var urlStr = location.search; ) { theRequest={}; return; } urlStr = urlStr.subs ...

  3. html传值 location.search取

    $(function() { var url = decodeURI(location.search); if (url.indexOf("?") != -1) { var str ...

  4. js通过location.search来获取页面传来的参数

    这篇文章主要介绍了通过window.location.search来获取页面传来的参数,经测试是OK的 ? 1 2 3 4 5 function GetQueryString(name) { var ...

  5. 最全的jQuery知识汇总

    本帖最后由 断天涯大虾 于 2016-12-26 10:22 编辑<ignore_js_op> jQuery是什么? jQuery是javascript编写一个可重用的JavaScript ...

  6. Jquery知识

    1.窗口自适应调整 (设置layout的fit属性值为true即可) //窗口自适应调整 $(function() { windowResize(); //文档载入时加载 $(window).resi ...

  7. window.location.search

    http://i.cnblogs.com/EditPosts.aspx?opt=1&opt2=x 就拿上面这个URL来说window.location.search的返回值为opt=1& ...

  8. js中location.search、split()HTML5中localStorage

    1. location.search在客户端获取Url参数的方法 location.search是从当前URL的?号开始的字符串 如:http://www.baidu.com/s?wd=baidu&a ...

  9. window.location.search作用

    window.location.search.substr(1).split("&") 这里面的相关属性和时间还有参数能具体说明一下吗?window.location wi ...

随机推荐

  1. 【BZOJ4543】[POI2014]Hotel加强版 长链剖分+DP

    [BZOJ4543][POI2014]Hotel加强版 Description 同OJ3522数据范围:n<=100000 Sample Input 7 1 2 5 7 2 5 2 3 5 6 ...

  2. 选项卡jQuery(ele).each()

    $("li").each(index){    $(this).mouseover(fucntion(){           $("div.contentin" ...

  3. Trifo-VIO:Roubst and Efficient Stero Visual Inertial Odometry using Points and Lines论文笔记

    这是2018-IROS上的一篇文章,亮点是作者提出了Lines特征的VIO方案,还有就是提出一个新颖的回环检测,不是用传统的基于优化的方法或者BA,另外作者还发布了一个新的用于VIO的数据集.亮点主要 ...

  4. AutoArchive settings explained

    AutoArchive settings explained Applies To: Outlook 2010 More... Less AutoArchive helps manage the sp ...

  5. Button 自动换行

    UIView *view=[[UIView alloc]initWithFrame:CGRectMake(0, 200, self.view.frame.size.width, 300)]; view ...

  6. log4j 日志相关

    1.log 打印异常信息 Logger logger = Logger.getLogger(LoggerTest.class);  //追踪产生此日志的类 Logger extends Categor ...

  7. 使用数组初始化list

    ArrayList<String> names = new ArrayList<String>(Arrays.asList("Delete","I ...

  8. 初识python(二)

    初识python(二) 1.变量 变量:把程序运行的中间结果临时的存在内存里,以便后续的代码调用. 1.1 声明变量: #!/usr/bin/env python # -*- coding: utf- ...

  9. 分别用request和socket给百多发送请求

    1.方式1 import socket client = socket.socket() # 百度创建连接: 阻塞 client.connect(('www.baidu.com',80)) # 问百度 ...

  10. linux环境变量配置文件

    环境变量配置文件中主要是定义对系统操作环境生效的系统默认环境变量,如PATH等.当你登陆Linux系统启动一个bash shell时,默认情况下bash会几个文件中查找命令,bash检查的启动文件取决 ...