Garbled characters occur when the jsp tutorial is used to pass Chinese parameters to the servlet at the backend. After reading the code on the Internet, there are many codec methods available and there are many other methods. Finally, this method is
Static URL, use regular to get URL parameter to route good or htacess rewrite good?
Daniel, what do you do?
Rookie thinks
Htacess The only downside is that the server environment does not support Htacess is dumbfounded win system more
Compile a JavaScript function parsequerystring. Its purpose is to parse the URL parameter into an object.
For example: var url = "http://www.taobao.com/index.php? Key0 = 0 & key1 = 1 & key2 = 2"VaR OBJ = new parsequerystring (URL );Alert (obj. key0)
This article is from: script House (Www.jb51.net) For details, refer:Http://www.jb51.net/article/13242.htm----------------------------------------------------------
/* -- Get the parameters passed on the webpage --*/
Function request (paras) {var url = location. href; var parastring = URL. substring (URL. indexof ("? ") + 1, URL. length ). split ("&"); var paraobj = {} for (I = 0; j = parastring [I]; I ++)
The quickest way to JS
JS Code:
The code is as follows
Copy Code
function getquerystring (name){var reg = new RegExp ("(^|&)" + name + "= ([^&]*) (&|$)");var r = window.location.search.substr (1). Match (REG);if
I remember using JS to convert the URL parameter to an array method I've written before, results yesterday to interview, there is also the interview topic, and then do not know the head suddenly bad, then unexpectedly did not have minutes to write
This two days to encounter the operation of the URL js, online Search A lot of methods, are direct operation, use is very inconvenient, there are many duplicate code.
So set hundred home strict, summed up the various methods, it compressed into a
How to use JavaScript to get URL parameter examples JavaScript gets url parameter method:
function request (paras)
{
var url = location.href;
var parastring = url.substring (Url.indexof ("?") +1,url.length). Split ("&");
var paraobj = {}
For (i=0
function code
Copy Code code as follows:
function parseURL (URL) {
var a = document.createelement (' a ');
A.href = URL;
return {
Source:url,
Protocol:a.protocol.replace (': ', '),
Host:a.hostname,
Port:a.port,
First, the regular expression, directly find the value of the right side of the parameter equals. However, it is not feasible to have & after this parameter.
var str = window.location.href;
var es =/clid =/;
Es.exec (str);
var right =
Before modification:
Copy Code code as follows:
After modification:
Copy Code code as follows:
Thanks to the grassroots program ape is very powerful to rewrite this method, more rigorous, efficient,
A value that takes a parameter from a URL without having to loop purely with a regular implementation. The core technique for replacing loops is that the replace () method of a string can be used as a second parameter and replaced by a user-defined
PHP determines whether the form or URL parameter data is an integer, and the Is_int function does not have the means to determine whether it is an integer because the form comes over a string of data from the form or URL parameter.Is_numeric can be
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.