Location.search

In this chapter you will learn:

  1. How to use search property in Location object

search property

The search property can be set with new values that alter the current URL.

assume starting at http://www.java2s.com/index.htm

location.search = "?q=javascript";

changes URL to "http://www.java2s.com/index.htm?q=javascript"

<!DOCTYPE HTML> /*jav a  2 s  . c om*/
<html> 
    <body> 
        <script> 
                location.search = "?q=javascript"; 
        </script> 
    </body> 
</html>

Next chapter...

What you will learn in the next chapter:

  1. Document Object Members
  2. Document Object Events
Home » Javascript Tutorial » Location
Location
assign method
Location.hash
Location.hostname
Location.href
location.pathname
location.port
location.reload
location.replace()
Location.search