A single description of location properties, usage, and related examples:
Location
Contains information about the current URL.
Describe
The Location object describes the complete URL associated with a given Window object. Each property of the location object describes the different attributes of the URL.
Typically, a URL will have the following format:
Protocol/HOST: Port/path name # Hash ID? search criteria
<script language= "Web Effects" >
function Gotourl (URL)
{
Location.href=url;
}
</script>
<select name= "" Onchange= "Javascript:gotourl (this.value);" >
<option value= "/user/online.php Tutorial" > select display Mode </option>
<option value= "/user/online.php?t=1". if ($t ==1) {echo ' selected= ' selected ';}? > > Only show Handsome guy </option>
<option value= "/user/online.php?t=2". if ($t ==2) {echo ' selected= ' selected ';}? >> Show only Beauty </option>
</select>
Protocol return address Protocol, value ' http: ', ' HTTPS tutorial: ', ' File: ' And so on.
Hostname return address host name, for example, a "http://www.zutiai.com.com/n86/" address, Location.hostname = = ' www.microsoft.com '.
Port returns the port number of the address, and the general HTTP port number is ' 80 '.
Host returns the hostname and port number, such as: ' www.a.com:8080 '.
Pathname returns the path name, such as "http://www.a.com/b/c.html", location.pathname = = ' b/c.html '.
Hash returns "#" and later content, such as "http://www.a.com/b/c.html#chapter4", Location.hash = = ' #chapter4 '; if there is no "#" in the address, an empty string is returned.
Search return "?" and later content, such as "http://www.a.com/b/c.asp tutorial? selection=3&jumpto=4", Location.search = = '? selection=3&jumpto= 4 '; If there is no "?" in the address, an empty string is returned.
HREF returns all of the above, that is, return the entire address. How to show it on the browser's address bar is how to return it. If you want a window object to open an address, you can use "Location.href = ' ... '", or you can use "location = ' ... '" to do this.