1. <i id='UZwZP'><tr id='UZwZP'><dt id='UZwZP'><q id='UZwZP'><span id='UZwZP'><b id='UZwZP'><form id='UZwZP'><ins id='UZwZP'></ins><ul id='UZwZP'></ul><sub id='UZwZP'></sub></form><legend id='UZwZP'></legend><bdo id='UZwZP'><pre id='UZwZP'><center id='UZwZP'></center></pre></bdo></b><th id='UZwZP'></th></span></q></dt></tr></i><div id='UZwZP'><tfoot id='UZwZP'></tfoot><dl id='UZwZP'><fieldset id='UZwZP'></fieldset></dl></div>

    1. <small id='UZwZP'></small><noframes id='UZwZP'>

    2. <legend id='UZwZP'><style id='UZwZP'><dir id='UZwZP'><q id='UZwZP'></q></dir></style></legend>
        <bdo id='UZwZP'></bdo><ul id='UZwZP'></ul>
      <tfoot id='UZwZP'></tfoot>

      如何使用 Javascript 读取获取请求?

      How to read get request using Javascript?(如何使用 Javascript 读取获取请求?)
        <bdo id='2YIpY'></bdo><ul id='2YIpY'></ul>
        <tfoot id='2YIpY'></tfoot>

              <tbody id='2YIpY'></tbody>

                <legend id='2YIpY'><style id='2YIpY'><dir id='2YIpY'><q id='2YIpY'></q></dir></style></legend>

              1. <i id='2YIpY'><tr id='2YIpY'><dt id='2YIpY'><q id='2YIpY'><span id='2YIpY'><b id='2YIpY'><form id='2YIpY'><ins id='2YIpY'></ins><ul id='2YIpY'></ul><sub id='2YIpY'></sub></form><legend id='2YIpY'></legend><bdo id='2YIpY'><pre id='2YIpY'><center id='2YIpY'></center></pre></bdo></b><th id='2YIpY'></th></span></q></dt></tr></i><div id='2YIpY'><tfoot id='2YIpY'></tfoot><dl id='2YIpY'><fieldset id='2YIpY'></fieldset></dl></div>
              2. <small id='2YIpY'></small><noframes id='2YIpY'>

                本文介绍了如何使用 Javascript 读取获取请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                所以我有一个名为 A.html 的 html 页面,它是从 B.html 中这样调用的:A.html?varString="bla-bla-bla" 向 JS 发送 args 是否正确?如何从 JS 中解析 args?

                So I have html page called A.html it was called like this from B.html : A.html?varString="bla-bla-bla" Is it correct for sending args to JS? How to parse args from JS?

                (不使用任何框架,如 Jquery,在 IE6、FireFox 3 中工作)

                (not using any frameworks like Jquery, working in IE6, FireFox 3)

                推荐答案

                这是一个解析查询字符串的函数.将参数名称传递给它,它会返回值.

                Here is a function to parse the query string. Pass it the parameter name and it returns the value.

                function getQueryVariable(variable)
                { 
                  var query = window.location.search.substring(1); 
                  var vars = query.split("&"); 
                  for (var i=0;i<vars.length;i++)
                  { 
                    var pair = vars[i].split("="); 
                    if (pair[0] == variable)
                    { 
                      return pair[1]; 
                    } 
                  }
                  return -1; //not found 
                }
                

                这篇关于如何使用 Javascript 读取获取请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                keeping radio buttons checked after form submit(表单提交后保持选中单选按钮)
                Bootstrap radio button quot;checkedquot; flag(Bootstrap 单选按钮“已选中旗帜)
                Toggle HTML radio button by clicking its label(通过单击标签来切换 HTML 单选按钮)
                Javascript how to change radio button label text?(Javascript如何更改单选按钮标签文本?)
                JavaScript radio button confirmation(JavaScript 单选按钮确认)
                How can I automatically select specific radio buttons with Greasemonkey?(如何使用 Greasemonkey 自动选择特定的单选按钮?)
                <i id='srnV9'><tr id='srnV9'><dt id='srnV9'><q id='srnV9'><span id='srnV9'><b id='srnV9'><form id='srnV9'><ins id='srnV9'></ins><ul id='srnV9'></ul><sub id='srnV9'></sub></form><legend id='srnV9'></legend><bdo id='srnV9'><pre id='srnV9'><center id='srnV9'></center></pre></bdo></b><th id='srnV9'></th></span></q></dt></tr></i><div id='srnV9'><tfoot id='srnV9'></tfoot><dl id='srnV9'><fieldset id='srnV9'></fieldset></dl></div>

                1. <small id='srnV9'></small><noframes id='srnV9'>

                  <legend id='srnV9'><style id='srnV9'><dir id='srnV9'><q id='srnV9'></q></dir></style></legend>
                      <bdo id='srnV9'></bdo><ul id='srnV9'></ul>

                        1. <tfoot id='srnV9'></tfoot>
                            <tbody id='srnV9'></tbody>