-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathquery.html
More file actions
26 lines (24 loc) · 762 Bytes
/
query.html
File metadata and controls
26 lines (24 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!DOCTYPE html>
<html>
<head>
<title>Test Page</title>
<meta charset="utf-8" />
</head>
<body>
<h3>Result</h3>
<div style="color: green" id="result">No value yet</div>
<script type="text/javascript" charset="utf-8">
function getParameterByName(name) {
url = window.location.href;
name = name.replace(/[\[\]]/g, '\\$&');
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}
var res = document.getElementById('result');
res.innerHTML = 'foo: ' + getParameterByName('foo') + '<br>' + 'urlType: ' + getParameterByName('urlType');
</script>
</body>
</html>