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
Release: 2016-05-16 18:55:28
Original
973 people have browsed it
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? ?
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template