zoukankan      html  css  js  c++  java
  • js-获取url中传递的参数

    1 (function ($) {
    2         $.getUrlParam = function (name) {
    3             var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    4             var r = window.location.search.substr(1).match(reg);
    5             if (r != null) return decodeURIComponent(r[2]);
    6             return null;
    7         }
    8     })(jQuery);

    栗子:window.location.href="price.jsp?total="+sum+"&deviceId="+deviceId;

    total = $.getUrlParam('total');
    deviceId = $.getUrlParam('deviceId');
    历经苦难而不厌,此乃阿修罗之道。
  • 相关阅读:
    PKU1008
    PKU 1007
    PKU 3983
    PKU 1005
    PKU1004
    PKU 1003解题
    new.target
    debugger 关键字
    React 高阶组件
    CSS|规范
  • 原文地址:https://www.cnblogs.com/echo1314/p/10256989.html
Copyright © 2011-2022 走看看