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. 并发容器J.U.C --组件FutureTask、ForkJoin、BlockingQueue

    FutureTask FutureTask是J.U.C中的类,是一个可删除的异步计算类.这个类提供了Future接口的的基本实现,使用相关方法启动和取消计算,查询计算是否完成,并检索计算结果.只有在计 ...

  2. JZOJ.5280【NOIP2017模拟8.15】膜法师

    Description

  3. shared_ptr & weak_ptr

    shared_ptr <1> 类模板说明 namespace boost { class bad_weak_ptr: public std::exception; template< ...

  4. svn实现共享文件夹/文件或svn文件夹/文件链接

    我们在实际开发过程中,经常会遇到这种情况,多个项目组使用同一公共底层代码:公共底层代码是有专门负责人开发的,其它项目组只是使用即可,那么多个项目组就需要把公共底层代码放到各自的解决方案或目录文件下,解 ...

  5. 创建超小的Golang docker 镜像

    原文: http://colobu.com/2015/10/12/create-minimal-golang-docker-images/ 本文对于创建超小的镜像非常有用 Docker是PaaS供应商 ...

  6. 巨蟒python全栈开发-第12天 生成器函数 各种推导式 yield from

    一.今日主要内容总览(重点) 1.生成器(目的:帮助我们创建对象) (1)生成器的本质就是迭代器 (2)一个一个的创建对象 (3)创建生成器的方式: 1.生成器函数 2.通过生成器表达式来获取生成器 ...

  7. AutoArchive settings explained

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

  8. join-case

    SELECT trd.* ,(CASE WHEN ta.AccountID IS null THEN '' ELSE ta.AccountID END ) FROM traceroleid trd L ...

  9. time/datetime/random/string/os/sys/shutil/zipfile/tarfile - 总结

    time 模块: time.time() #时间戳 time.localtime() #当前时间对象元组 time.localtime(123123) #根据时间戳的时间对象 time.mktime( ...

  10. Neutron相关资料链接

    1.OpenStack Neturon 官方文档: https://docs.openstack.org/mitaka/networking-guide/ 2.Neturon理解系列文章: http: ...