way 1:
<script. type="text/javascript">
<!--
String.prototype.getQuery = function(name) {
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = this.substr(this.indexOf("\?")+1).match(reg);
if (r!=null) return unescape(r[2]); return null;
}
var strHref = "www.xx.com/index.htm?a=aaa&b=bbb&c=ccc";
alert(strHref.getQuery("a"));
alert(strHref.getQuery("b"));
alert(strHref.getQuery("c"));
//-->
</script>
way 2:
<script. type="text/javascript">
function getUrlPara(paraName){
var sUrl = location.href;
var sReg = "(?:\\?|&){1}"+paraName+"=([^&]*)"
var re=new RegExp(sReg,"gi");
re.exec(sUrl);
return RegExp.$1;
}
//应用实例:test_para.html?a=11&b=22&c=33
alert(getUrlPara("a"));
alert(getUrlPara("b"));
</script>
way 3:
<script. type="text/javascript">
<!--
function Request(strName){
var strHref = "www.xx.com/index.htm?a=aaa&b=bbb&c=ccc";
var intPos = strHref.indexOf("?");
var strRight = strHref.substr(intPos + 1);
var arrTmp = strRight.split("&");
for(var i = 0; i < arrTmp.length; i++) {
var arrTemp = arrTmp[i].split("=");
if(arrTemp[0].toUpperCase() == strName.toUpperCase()) return arrTemp[1];
}
return "";
}
alert(Request("a"));
alert(Request("b"));
alert(Request("c"));
//-->
</script>
相关推荐
By the end of this book, you’ll know how to analyze traffic, find patterns of various offending traffic, and secure your network from them. What You Will Learn Configure Wireshark 2 for effective ...
Turi Create and Keras: Learn how to tune parameters to improve your machine learning model using more advanced tools. Image Classification: Learn how to apply machine learning models to predict ...
Turi Create and Keras: Learn how to tune parameters to improve your machine learning model using more advanced tools. Image Classification: Learn how to apply machine learning models to predict ...
Turi Create and Keras: Learn how to tune parameters to improve your machine learning model using more advanced tools. Image Classification: Learn how to apply machine learning models to predict ...
This chapter is a self-contained tutorial which tells you how to get started with parallel programming and how to design and implement algorithms in a structured way. The chapter introduces a simple ...
LUA comes with its own library that contains ready-to-use functions but I prefer you to explain the complete version so you can understand better how LUA works. In order to execute LUA scripts you ...
The book starts with the basics of the framework and how to get data to your dashboards. We’ll take you all the way through to creating custom and advanced dashboards and creating an effective visual...
How to check your JavaScript source code for common mistakes without actually running the script or opening the web page Character properties at your fingertips Access the properties of a character ...
The book covers PostgreSQL from a data architect's perspective – covering topics from installation from source to designing tables using SQL Power Architect, as well as deciding replication and ...
Discover how to send data to control 3D from a web browser to the graphics card for rich and engaging graphical presentation Understand the role of graphics card programming using shader languages to ...
this, you'll learn how to set up replication, use load balancing to scale horizontally, and troubleshoot errors. As you continue through this book, you will see the significant impact of configuration...
Chapter 11 explains how to use the Simulink debugger to debug Simulink models. It also documents debugger commands. Appendix A lists model and block parameters. This information is useful with the get...
What you will learn from this book, Learn how to build a FIX protocol parser, Calibrate counting processes on real data, Estimate model parameters using the Maximum Likelihood Estimation method, Use ...
In this chapter, you’ll explore how to pass optional parameters (aka options) as well as arguments (parameters which are expected) to your custom command to alter functionality or logic in your ...
The book starts off with an explanation of the fundamental audio concepts, after which it proceeds to explain how to use the FMOD Ex library, how to implement a 3D audio simulation, how to use the ...