The following example displays an alert (message) box for the current window. alert("A simple message.") The following example checks whether the current window contains child windows and, if it does, displays the names of those child windows. if (window.frames!=null) { for (i=0; i Properties clientInformation, closed, defaultStatus, dialogArguments, dialogHeight, dialogLeft, dialogTop, dialogWidth, document, event, history, length*, location, name, navigator, offscreenBuffering, opener, parent*, returnValue, screen, self, status, top* Collections frames* Methods alert, blur, clearInterval, clearTimeout, close, confirm, execScript, focus, moveBy, moveTo, navigate, open*, prompt, resizeBy, resizeTo, scroll, scrollBy, scrollTo, setInterval, setTimeout, showHelp, showModalDialog* *An asterisk indicates properties not applicable to modal dialogs. Events onbeforeunload, onblur, onerror, onfocus, onhelp, onload, onresize, onscroll, onunload --------------------------------------- Examples The following example checks for a document title and displays the title (if not null) in an alert (message) box. if (document.title!="") alert("The title is " + document.title) The following example shows an event handler function that displays the current position of the mouse (relative to the upper-left corner of the document) in the browser's status window. Report mouse moves

Welcome!

Properties activeElement, alinkColor, bgColor, body, charset, cookie, defaultCharset, domain, expando, fgColor, lastModified, linkColor, location, parentWindow, readyState, referrer, selection, title, URL, vlinkColor Collections all, anchors, applets, children, embeds, forms, frames, images, links, plugins, scripts, styleSheets Methods clear, close, createElement, createStyleSheet, elementFromPoint, execCommand, open, queryCommandEnabled, queryCommandIndeterm, queryCommandState, queryCommandSupported, queryCommandText, queryCommandValue, ShowHelp, write, writeln Events onafterupdate, onbeforeupdate, onclick, ondblclick, ondragstart, onerrorupdate, onhelp, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onreadystatechange, onrowenter, onrowexit, onselectstart -------------------------------------------------------------------------------- Description Specifies the URL of the previous location. Syntax object.referrer --------------------------- Description Indicates the URL for the current document. Syntax object.url[ = URL] Remarks This property is an alias for the location.href property on the window. This property has read-write permissions. ------------------------------------------ location -------------------------------------------------------------------------------- Description Contains information on the current URL. Remarks The href property contains the entire URL, and the other properties contain portions of it. Location.href is the default property for the location object. For example, setting location='http://microsoft.com' is equivalent to setting location.href='http://microsoft.com'. By setting any of the following properties, the browser will initiate an immediate navigation to the newly specified URL. Properties hash, host, hostname, href, pathname, port, protocol, search Methods assign, reload, replace -------------------------------------- The Location Object When we learned that the navigate method of the window object could be used to display a new URL, we alluded to a child object, called location. The location object represents the current URL displayed by the browser. As you might expect, location's properties give information about the URL and its methods allow us to modify the browser's current location, but in a bit different way than we do with navigate. Properties The properties of location reflect every last thing we could ever hope to know about the link the browser is currently displaying. The following table describes each property and gives the value that the property would return for a URL of http://www.wrox.com:80/dhtml/book.htm?abc. Property Value Description href http://www.wrox.com:80/dhtml/book.htm?abc Complete URL protocol http: The protocol of the URL host www.wrox.com:80 Hostname and port number hostname www.wrox.com Name of host port 80 Port number (default is 80) pathname /dhtml/book.htm Path after the host property search ?abc Any value after a '?' in the URL hash (nothing in this example – would contain any anchor specified with #) Any value after a '#' in the URL In our example we haven't specified that we want to jump to any bookmark that might exist in the document. To jump to the anchor named two, we'd use an address similar to this: http://myserver/location.htm#two In this case the hash property of the location object would contain the string '#two'. If you look at the values for these properties a little closer, you'll see that the href property includes the information in all of the other properties. The browser parses the full href string and fills in the appropriate information for each property, saving us the trouble of interpreting the full string ourselves and making it easier to find any specific piece of information we might need without having to write explicit script code. The other cool thing about the href property is how it's dynamically tied to the browser. Read the href property and nothing special will happen; change the href property and the browser will display the new page. Changing the browser's current URL in this manner is exactly the same as using the window.navigate method. Methods In the old Internet Explorer 3.0 object model, the location object had no methods.This has changed with IE4. We now have three methods that give us a bit more control over the browser's current location. Method Description assign Loads the page specified, equivalent to changing the window.location.href property reload Reloads the current page and displays any changes to the HTML source replace Navigates to the URL passed as a parameter and replaces the current page in the history list with this new page With assign we can navigate to another page by passing the URL of the page when we call the method, like this: location.assign("http://www.microsoft.com") Using the reload method we can refresh the contents of a page we're viewing. While Internet Explorer 3.0 didn't have this method, we could achieve the same affect using the go method of the history object with a parameter of 0. This was an often-requested feature, and so it was given its own method in IE4. Replace, on the other hand, is a completely new method that enables functionality we didn't have at all with Internet Explorer 3.0. The immediate effect is no different to the user than changing the href property or using the navigate method of the window object: the page the browser is displaying changes. The difference lies in what is added (or in this case not added) to the history list of the browser. When we change pages in a conventional manner, each new page is added to the end of Internet Explorer's history list, forming a queue of visited pages. In contrast, if we use replace to change our location, the current URL is overwritten by the new URL and won't remain in the history list. -------------------------------------- The Window’s Location Object An alternative to using Navigate is to change the HRef property of the Window object’s Location object. The effect is the same. The browser window always shows the page at some URL—so it makes sense to have some way to represent the various properties of this spot on the World Wide Web or on an Intranet. The Location object is the way we do it. Paying attention to this object now will save us some time later— the properties of the Location object are reused more than once in the rest of the browser object model. You’ll find that the Document object has its own Location property, and that all of the links on a page are represented by a set of properties that mimic the properties of Window’s Location object. The mother of all Location properties is HRef. Out of the eight total properties that are a part of Location, seven are derived from the HRef property—and the eighth property is HRef itself. HRef returns the current URL for the page in the browser. If the page is the top level page of a frameset, it returns this top level URL. In addition to reading the current location, we can change it simply by setting this property. For example, the following line of code redirects the browser to the Wrox Press home page. Window, in this instance, is optional: Window.Location.href = "http://www.wrox.com" The remainder of Location’s properties are born from the HRef property. To illustrate what we mean, suppose we were viewing a page with the URL: http://www.wrox.com:80/asp/book.htm?abc. The following table shows how each of the properties would be set (a hash mark in this context is a # in the page’s HTML): Property Value Description href http://www.wrox.com:80/asp/book.htm?abc complete URL protocol http: URL’s protocol host www.wrox.com:80 hostname and port number hostname www.wrox.com name of host port 80 port number (default is 80) pathname /asp/book.htm path after host search ?abc any query string hash (nothing – would contain any hash specified with #) any hash value -------------------------------------- clientInformation -------------------------------------------------------------------------------- Description Returns the navigator object. You use this to retrieve information about the version and name of the browser, as well as whether certain features are enabled. Syntax object.clientInformation Examples The following JScript example checks whether the user agent name of the browser contains "MSIE". If it does, the browser is Microsoft® Internet Explorer. if (window.clientInformation.userAgent.indexOf( "MSIE " ) > 0) // is Microsoft Internet Explorer The following JScript example checks whether Java™ applets can be run. if (window.clientInformation.javaEnabled() == true ) // Java is enabled, applets can run Applies To window ---------------------------------- urn -------------------------------------------------------------------------------- Description Specifies a uniform resource name (URN) for a target document. Syntax object.urn[ = urn] Remarks This property has read-write permissions, meaning you can change as well as retrieve its current value. Applies To A ----------------------------------- url -------------------------------------------------------------------------------- Description Indicates the URL for the current document. Syntax object.url[ = URL] Remarks This property is an alias for the location.href property on the window. This property has read-write permissions. Applies To document ------------------------------------ url -------------------------------------------------------------------------------- Description If a URL is specified, reloads the URL after the time specified by the CONTENT= attribute of the META element has elapsed. Syntax object.url[ = url] Remarks This property has read-write permissions, meaning you can change as well as retrieve its current value. Applies To META ------------------------------------ navigator -------------------------------------------------------------------------------- Description Contains information about the Web browser. Properties appCodeName, appMinorVersion, appName, appVersion, browserLanguage,connectionSpeed, cookieEnabled, cpuClass, onLine, platform, systemLanguage, userAgent userLanguage, userProfile Methods javaEnabled, taintEnabled Collections mimeTypes, plugins Applies To window ------------------------------ platform -------------------------------------------------------------------------------- Description Indicates the platform that the browser is running on (for example, Win32®, Win16, WinCE, and so on). Syntax object.platform Remarks This property has read-only permission, meaning you can retrieve its current value, but not change it. Applies To navigator ------------------------------ userProfile -------------------------------------------------------------------------------- Description Provides methods that allow a script to request read access to a user's profile information, and to perform read actions. Note that the request is queued up before the reading or writing action is performed, which simplifies the user's experience because he or she is only prompted for profile release permissions once for a batch of requests. Example The following is an example of a script that can be run on the client to read various values from the profile information. // queue up a request for read access to multiple profile attributes navigator.userProfile.addReadRequest("vcard.displayname"); navigator.userProfile.addReadRequest("vcard.gender"); // request access to this information navigator.userProfile.doReadRequest(usage-code, "Acme Corporation"); // now perform read operations to access the information name = navigator.userProfile.getAttribute("vcard.displayname"); gender = navigator.userProfile.getAttribute("vcard.gender"); // the script can now use the 'name' and 'gender' variables // to personalize content or to send information back to the server // this is to support getting back to a clean slate by clearing the // request queue. navigator.userProfile.clearRequest(); Methods addReadRequest, clearRequest, doReadRequest, getAttribute -------------------------------------------------------------------------------- getAttribute -------------------------------------------------------------------------------- Description Returns the value of the named attribute. If read access for this attribute is not already available, this method simply returns the NULL string. Syntax navigator.userProfile.getAttribute(attributeName, attributeValue) Parameter Description attributeName One of the standard vCard names (listed below); otherwise the request is ignored and nothing is returned. attributeValue Value stored in the attributeName parameter. Remarks The following schema is used for the field names of the user data store. These names are specified when using the getAttribute method on the userProfile object. Please note that the format has changed from vCard_xxx to vCard.xxx and that the older format will no longer be supported. vCard Names vCard.Email vCard.DisplayName vCard.FirstName vCard.LastName vCard.MiddleName vCard.Cellular vCard.Gender* vCard.JobTitle vCard.Pager vCard.Company vCard.Department vCard.Notes vCard.Office vCard.Homepage vCard.Home.StreetAddress vCard.Home.City vCard.Home.State vCard.Home.Zipcode vCard.Home.Country vCard.Home.Phone vCard.Home.Fax vCard.Business.StreetAddress vCard.Business.City vCard.Business.Phone vCard.Business.Fax vCard.Business.URL vCard.Business.State vCard.Business.Country vCard.Business.Zipcode Note (*) asterisk denotes extensions to the vCard schema, which will be referenced as X- elements as defined in the vCard schema. Applies To userProfile -------------------------------------------------------------------------------- navigate -------------------------------------------------------------------------------- Description Equivalent to the window.location.href property. Syntax object.navigate(URL) Parameter Description URL (String) URL to be displayed. Return Value No return value. Applies To window See Also href property ------------------------------------------- go -------------------------------------------------------------------------------- Description Loads a URL in the History list. Syntax object.go(delta | location) Parameter Description delta | location delta is an integer representing a relative position in the History list. location is a string representing all or part of a URL in the History list. Return Value No return value. Remarks Trying to go past the beginning or end of the history does not generate an error. Instead, you are left at the current page. Applies To history See Also back, forward ------------------------- history -------------------------------------------------------------------------------- Description Contains information on the URLs that the client has previously visited. Property length Methods back, forward, go Applies To window ------------------------------------ back -------------------------------------------------------------------------------- Description Loads the previous URL in the History list. Syntax object.back( ) Return Value No return value. Remarks This method performs the same action as a user choosing the Back button in the browser. The back method is the same as history.go(-1). Trying to go past the beginning of the history does not generate an error. Instead, you are left at the current page. Applies To history See Also forward, go ----------------------------------- forward -------------------------------------------------------------------------------- Description Loads the next URL in the History list. Syntax object.forward( ) Return Value No return value. Remarks This method performs the same action as a user choosing the Forward button in the browser. The forward method is the same as history.go(1). Trying to go past the end of the history does not generate an error. Instead, you are left at the current page. Applies To history See Also back, go ---------------------------------------- opener -------------------------------------------------------------------------------- Description Returns a reference to the window that created the current window. Syntax object.opener[ = opener] Remarks This property has read-write permissions, meaning you can change as well as retrieve its current value. Applies To window -------------------------------------- replace -------------------------------------------------------------------------------- Description Replaces the current document by loading the document at the given url. This method also removes the current document from the browser's session history. Syntax object.replace(url) Parameter Description url String specifying the URL to insert into the session history. Remarks Replacing a document causes it to no longer be accessible through the history object. Also, the URL is no longer accessible through the user interface navigation methods (Back, Forward, and so on). Applies To location --------------------------------- reload -------------------------------------------------------------------------------- Description Reloads the current page. Syntax object.reload([bReloadSource] ) Parameter Description bReloadSource Optional. Boolean value specifying whether to reload the page from the cache or server. If TRUE, the page is reloaded from the server. By default, this parameter is FALSE. Return Value No return value. Applies To location -------------------------------------------------------------------------------- assign -------------------------------------------------------------------------------- Description Sets the current location to url. This method loads the given document specified by url if it exists. Syntax object.assign(url) Parameter Description url String specifying the URL of the document to assign. Return Value No return value. Applies To location ========================================== Description Returns information on the current URL. The href property contains the entire URL, and the other properties contain portions of it. The full list of properties includes: hash, host, hostname, href, pathname, port, protocol, and search. Syntax object.location[ = location] Remarks This property has read-write permissions, meaning you can change as well as retrieve its current value ------------------------------- Description Sets or returns the subsection of the href property that follows the # symbol. Syntax object.hash[ = hash] Remarks If there is no hash, this property returns an empty string. This property is useful for moving to a bookmark within a document. Assigning an invalid value does not cause an error. This property has read-write permissions, meaning you can change as well as retrieve its current value. ------------------------------------ Description Sets or retrieves the hostname:port part of the location or URL. Syntax object.host[ = host] Settings This read-write property is the concatenation of the hostname and port properties, separated by a colon. When the port property is null, the host property is the same as the hostname property. You can set the host property at any time, although it is safer to set the href property to change a location. If the host that you specify cannot be found, you will get an error. ------------------------------------ Description Specifies the host name part of the location or URL. Syntax object.hostname[ = hostname] Remarks If no host name is available, this property returns an empty string. This property has read-write permissions, meaning you can change as well as retrieve its current value. --------------------------------------- Description Specifies the file or object path. Syntax object.pathname[ = pathname] Remarks This property has read-write permissions, meaning you can change as well as retrieve its current value. --------------------------------------- Description Specifies the port number in a URL. Syntax object.port[ = port] Remarks If no port is specified, an empty string is returned. This property has read-write permissions, meaning you can change as well as retrieve its current value. ---------------------------------------- Description Specifies the initial substring up to and including the first colon, which indicates the URL's access method. Syntax object.protocol[ = protocol] Remarks This property has read-write permissions, meaning you can change as well as retrieve its current value. ---------------------------------------- Description Indicates the substring of the href property that follows the ? symbol. This is the query string or form data. Syntax object.search[ = search] Remarks This property has read-write permissions, meaning you can change as well as retrieve its current value. ========================================== Description Returns the window object for the document. Syntax object.parentWindow Remarks This property has read-only permission, meaning you can retrieve its current value, but not change it ------------------------------ Description Specifies the current state of an object being downloaded. Syntax object.readyState Settings Possible values include: uninitialized The object is not initialized with data. loading The object is currently loading its data. interactive The object can be interacted with even though it is not fully loaded. complete The control is completely loaded. Remarks Each object can independently determine which of the four states it exposes. This property has read-only permission, meaning you can retrieve its current value, but not change it. Applies To IMG, LINK, OBJECT, SCRIPT, STYLE, document See Also onreadystatechange -------------------------------------------- onreadystatechange -------------------------------------------------------------------------------- Description Fires whenever the ready state for the object has changed. Remarks Each object can choose to expose which set of ready states it is exposing. This event should be fired whenever the ready state is changed. When an element changes to the loaded state, this event fires immediately before the firing of the load event. This event will not bubble. Events that do not bubble can only be handled on the individual object that fired the event. Applies To APPLET, EMBED, IMG, LINK, OBJECT, SCRIPT, STYLE, document See Also onload, readyState -------------------------------------------------------------------------------- onload -------------------------------------------------------------------------------- Description Fires immediately after the browser loads the given object. Remarks The browser loads applications, embedded objects, and images as soon as it encounters the APPLET, EMBED, and IMG elements during parsing. This means that the onload event for these objects occurs before the browser parses any subsequent elements. To ensure that an event handler receives the onload event for these elements, you must place the SCRIPT element that defines the event handler before the element and use the onload attribute in the element to set the handler. The onload attribute of the BODY element sets an onload event handler for the window. Setting an onload event handler for the window object by any other means will override the handler set using the onload attribute if the handlers are in the same script language. This event will not bubble. Events that do not bubble can only be handled on the individual object that fired the event. Examples The following JScript example is an onload event handler for the window. The following JScript example sets an onload event handler for an IMG element. The handler uses the event object to retrieve the URL of the image. Applies To APPLET, EMBED, FRAMESET, IMG, LINK, SCRIPT, STYLE, window ---------------------------------------------------------------------------------- lastModified -------------------------------------------------------------------------------- Description Contains the last-modified date of the page (if the page supplies one). Syntax object.lastModified Remarks This property has read-only permission, meaning you can retrieve its current value, but not change it. Applies To document ---------------------------- domain -------------------------------------------------------------------------------- Description Sets or returns the security domain of the document. Syntax object.domain[ = domain] Settings This read-write property initially returns the host name of the server the page is from. It can be assigned the domain suffix to allow sharing of pages across frames. For example, a page in one frame from home.microsoft.com and a page from www.microsoft.com would initially not be able to communicate with each other. However, by setting the domain property of both pages to the suffix, microsoft.com, both pages would be considered secure and now access is available between the pages. Applies To document ------------------------- cookie -------------------------------------------------------------------------------- Description Specifies a string value of a cookie, which is a small piece of information stored by the browser. Cookies are made from the following. (All are optional with the exception of the name=value pair.) Arguments are separated by semicolons. name=value; Each cookie is stored in a name=value pair, that is, if the cookie is "foo" and you want to save foo's value as "bar", the cookie would be saved as foo=bar. You can save as many name=value pairs in the cookie as you want, but the cookie is always returned as a string of all the cookies that apply to the page, so the string that is returned has to be parsed to find the values of individual cookies. Expires=date; If no expiration is set on a cookie, it will expire when the browser is closed. Setting an expiration date in the future causes the cookie to be saved across browser sessions. Setting an expiration date in the past will delete a cookie. The date should be specified using GMT format. domain=domainname; The domain of the cookie can be set, which allows pages on a domain made up of more than one server to share cookie information. path=path; Setting a path for the cookie will allow the current document to share cookie information with other pages within the same domain, that is, if the path is set to /foobar, all pages in /foobar and all pages in subfolders of /foobar will be able to access the same cookie information. secure; Specifying a cookie as "secure" means that the stored cookie information can be accessed only from a secure environment. Syntax object.cookie[ = cookie] Remarks Use string methods such as substring, charAt, indexOf, and lastIndexOf to determine the value stored in the cookie. This property has read-write permissions, meaning you can change as well as retrieve its current value. Applies To document --------------------------------------------------------------------------------------- activeElement -------------------------------------------------------------------------------- Description Identifies the element that has the focus. This read-only property is set when you select a control in the interface or use the focus method. Syntax object.activeElement Applies To document ============================================================================================== Collections all -------------------------------------------------------------------------------- Description Returns an object reference to the collection of elements contained by the object. Syntax object.all(index) Parameter Description object An object that can contain elements such as the document. (index) Optional. An integer or a string specifying the index value of the element to retrieve. Integer indexes are zero-based, meaning the first element in the collection has index 0. A string index is valid only if the string is a name or identifier of at least one element in the document. Remarks The all collection includes one element object for each valid HTML tag. If a valid tag has a matching end tag, both tags are represented by the same element object. The collection returned by the document's all property always includes a reference to the HTML, HEAD, TITLE, and BODY objects regardless of whether the tags are present in the document. If the document contains invalid or unknown tags, the collection includes one element object for each. Unlike valid end tags, unknown end tags are represented by their own element objects. The order of the element objects is the HTML source order. Although the collection indicates the order of tags, it does not indicate hierarchy. Examples The following JScript example displays the names of all tags in the document in the order the tags appear in the document. for(i=0; i

Some text in a paragraph

The children collection for divONE would include IMG, DIV, and BUTTON. The children collection for divTWO would include P. Applies To A, ACRONYM, ADDRESS, APPLET, AREA, B, BASE, BASEFONT, BGSOUND, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, COMMENT, DD, DEL, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, FRAMESET, H1, H2, H3, H4, H5, H6, HEAD, HR, HTML, I, IFRAME, IMG, INPUT, INS, KBD, LABEL, LEGEND, LI, LINK, LISTING, MAP, MARQUEE, MENU, OBJECT, OL, OPTION, P, PLAINTEXT, PRE, Q, S, SAMP, SCRIPT, SELECT, SMALL, SPAN, STRIKE, STRONG, STYLE, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TITLE, TR, TT, U, UL, VAR, XMP ---------------------------------------- embeds -------------------------------------------------------------------------------- Description Retrieves a collection of all EMBED elements on the document. Syntax object.embeds(index) Parameter Description object The document object. (index) Optional. An integer or a string specifying the index value of the element to retrieve. Integer indexes are zero-based, meaning the first element in the collection has index 0. A string index is valid only if the string is an identifier of at least one element in the document. Remarks If duplicate identifiers are found, a collection of those items is returned. Collections of duplicates must subsequently be referenced by ordinal position. Property length Methods item, tags Applies To document -------------------------------------------------- plugins -------------------------------------------------------------------------------- Description This is an alias for the embeds collection on the document. Syntax object.plugins(index) Parameter Description object The document object. (index) Optional. An integer or a string specifying the index value of the element to retrieve. Integer indexes are zero-based, meaning the first element in the collection has index 0. A string index is valid only if the string is a name or identifier of at least one element in the document. Remarks This collection is indexed first by name, then by identifier. If duplicate names are found, a collection of those named items is returned. Collections of duplicate names must subsequently be referenced by ordinal position. Property length Methods item, tags Applies To document -------------------------------------------------- forms -------------------------------------------------------------------------------- Description Retrieves a collection, in source order, of all FORM elements in the document. Syntax object.forms(index) Parameter Description object The document object. (index) Optional. An integer or a string specifying the index value of the element to retrieve. Integer indexes are zero-based, meaning the first element in the collection has index 0. A string index is valid only if the string is a name or identifier of at least one element in the document. Remarks This collection is indexed first by name, then by identifier. If duplicate names are found, a collection of those named items is returned. Collections of duplicate names must subsequently be referenced by ordinal position. Property length Methods item, tags Applies To document ---------------------------------------------------------- frames -------------------------------------------------------------------------------- Description Retrieves a collection of all window objects defined by the given document or defined by the document associated with the given window. Syntax object.frames(index) Parameter Description object Either the document or window object. (index) Optional. An integer or a string specifying the index value of the window to retrieve. Integer indexes are zero-based, meaning the first window in the collection has index 0. A string index is valid only if the string is the name of one window in the document. Remarks If the HTML source document contains a BODY tag, the collection contains one window for each IFRAME element in the document. If the source document contains FRAMESET tags, the collection contains one window for each FRAME tag in the document. In both cases, the order is determined by the HTML source. This collection contains window objects only and does not provide access to the corresponding FRAME and IFRAME elements. To access these elements, use the all collection for the document containing the elements. Although you can use names with the item method on this collection, the method never returns a collection. Instead, it always returns the first window having the given name. To ensure that all windows are accessible, you should always make sure that no two windows in a document have the same name. Examples The following JScript example displays the URLs of the HTML documents contained in windows created by the IFRAME elements in the document. var frm = document.frames; for (i=0; i object, specifically for image maps and select boxes, respectively. This allows you to change the length of the collection as necessary. In all other cases, this property has read-only permission, meaning you can retrieve its current value, but not change it. Applies To all, anchors, applets, areas, embeds, forms, frames, history, images, imports, links, plugins, scripts, SELECT, styleSheets, window See Also options collection ----------------------------------- Methods item -------------------------------------------------------------------------------- Description Retrieves an element or a collection from the given collection. The index determines which action to take. Syntax element = object.item(index [, subindex]) Parameter Description index Number or string specifying the element or collection to retrieve. If this parameter is a number, the method returns the element in the collection at the given position, where the first element has value 0, the second has 1, and so on. If this parameter is a string, the method returns a collection of elements, where the value of the name or id property for each element is equal to the string. subindex Optional. Number specifying the position of an element to retrieve. This parameter is used when index is a string. The method uses the string to construct a collection of all elements that have a name or id equal to the string, then retrieves from this collection the element at the position specified by subindex. Return Value Returns an element object or a collection of element objects if successful, or null otherwise. Examples The following JScript example uses the item method to retrieve each element from the document. In this case, the method parameter is a number, so the elements are retrieved in the order in which they appear in the document. var coll = document.all; if (coll!=null) { for (i=0; i