The code is as follows: Give it a try!
<script> <br>String.prototype.getQuery = function(name) <br>{ <br> var reg = new RegExp("(^|&)" name "=([^&]*)(&|$)"); <br> var r = this.substr(this.indexOf( "?") 1).match(reg); <br> if (r!=null) return unescape(r[2]); return null; <br>} <br>var str ="www.abc.com /index.htm?a=1&b=1&c=test test"; <br>alert(str.getQuery("a")); <br>alert(str.getQuery("b")); <br>alert( str.getQuery("c")); <br></script>
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