Home >Web Front-end >JS Tutorial >JavaScript RegExp method to get address bar parameters (object-oriented)_js object-oriented

JavaScript RegExp method to get address bar parameters (object-oriented)_js object-oriented

WBOY
WBOYOriginal
2016-05-16 18:55:28977browse
Copy code The code is as follows:

Request = {
QueryString : function(item){
var svalue = location.search.match(new
RegExp('[?&]' item '=([^&]*)(&?)','i'));
return svalue ? svalue[1] : svalue;
}
}
var key = Request.QueryString('key');

Is Request.QueryString very similar to ASPNET and JAVA? ?
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn