Location -- location is used to obtain or set the URL of a form and parse the URL. It is one of the most important objects in Bom.
- LocationThe meaning of Chinese "location"
- URL: http://www.dreamdu.com/javascript/window.location/
- Location is both the property of the window object and the property of the Document Object.
- Location contains eight attributes, 7 of which are part of the URL of the current form. The remaining and most important is the href attribute, which represents the URL of the current form.
- The eight attributes of location are both readable and writable, but only the href and hash attributes are supported.WriteMake sense. For example, change location. href locates a URL and modifies the location. hash will jump to the anchor (<a id = "name"> or <Div id = "ID">) name tag on the current page (if any ), and the page will not be reloaded.
Note: The two addresses of different protocols or hosts cannot reference the location object of each other. This is a security requirement. For example, the current window opens a page under "www.a.com", and another window (Object Name: bwindow) opens a webpage of "www. B .com. If "bwindow. Location" is used in the current window, an error occurs: "No permission ". This error cannot be handled.Program(Event handler, refer to onerror events) to receive and process events.
Attribute Overview
Hostname: The Host Name of the returned address. For example, for an address of "http://www.microsoft.com/china/#, location.hostname = 'www .microsoft.com '.
Pathname: return the path name, for example, http://www.a.com/ B /c.html#,location.pathname = 'B/c.html '.
Search returns "?" And later content, such as "http://www.a.com/ B /c.asp? Selection = 3 & jumpto = 4 ", location. Search = '? Selection = 3 & jumpto = 4'; if the address does not contain "?", Returns an empty string.
Href returns all the preceding content, that is, the entire address. Display it in the address bar of the browser and return it. If you want to open an address for a window object, you can use "location. href = '... '", you can also directly use" location = '....
<Select name = select1 size = 1 class = "select" onchange = javascript: window. Open (this. Options [This. selectedindex]. Value)>
<Option value = http://www.tcl.com selected >== TCL family ==</option>
<Option value = http://www.tcl.com/> tclgroup </option>
<Option value = http://www.tclking.com/> TCL trump card electronics </option>
</SELECT>
<% for I = 1 to totalpage %> selected =" selected "<% end if %> <% = I %> <% Next %>