zoukankan      html  css  js  c++  java
  • JS获取参数


        <script>

    function getArgs( ) {

        var args = new Object( );

        var query = location.search.substring(1);     // Get query string

        var pairs = query.split("&");                 // Break at ampersand

        for(var i = 0; i < pairs.length; i++) {

            var pos = pairs[i].indexOf('=');          // Look for "name=value"

            if (pos == -1) continue;                  // If not found, skip

            var argname = pairs[i].substring(0,pos);  // Extract the name

            var value = pairs[i].substring(pos+1);    // Extract the value

            value = decodeURIComponent(value);        // Decode it, if needed

            args[argname] = value;                    // Store as a property

        }

        return args;                                  // Return the object

    }

    </script>

    用法

    var a= getArgs();

    a["link"]

  • 相关阅读:
    selenium
    python第三方模块的安装
    程序员学习网站
    python 数据较大 性能分析
    linux ~/ 和 /
    VMWare虚拟机 window文件传递
    vi命令
    os.system
    win10系统进入BIOS
    pyinstaller将python脚本生成exe
  • 原文地址:https://www.cnblogs.com/mqingqing123/p/1912794.html
Copyright © 2011-2022 走看看