Javascript examples for Browser Object Model:Location
The search property sets or gets the querystring part of a URL, including the question mark (?).
The querystring part is the part of the URL after the question mark (?).
Set the search property with the following Values
Value | Type | Description |
---|---|---|
querystring | String | Sets the search part of the URL |
A String, representing the querystring part of a URL, including the question mark (?)
The following code shows how to Return the querystring part of a URL.
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from w w w. ja va 2 s . c o m*/ var x = location.search; document.getElementById("demo").innerHTML = x; } </script> </body> </html>