JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlLabelObj.accessKey
The accessKey
property of the HTMLLabelElement
object is a single character access key to give access to the form control.
Listing 11.189 illustrates the creation of an HTMLLabelElement
using the HTMLBodyElement
object and then setting its accessKey
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var labelObj = formObj.createElement("label");
labelObj.accessKey = "L";
// -->
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5
htmlLabelObj.form
The form
property of the HTMLLabelElement
returns the FORM
element containing this control. Returns Null
if this control isn’t within the context of a form.
Listing 11.190 illustrates the creation of an HTMLLabelElement
using the HTMLFormElement
object and then reading its form
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var labelObj = formObj.createElement("label");
if(labelObj.form.Name == "emailForm")
processEmailForm(labelObj.form);
// -->
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlLabelObj.htmlFor
The htmlFor
property of the HTMLLabelElement
object links this label with another form control by the id
attribute.
Listing 11.191 illustrates the creation of an HTMLLabelElement
using the HTMLFormElement
object element and then setting its htmlFor
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var labelObj = formObj.createElement("label");
var inputObj = formObj.createElement("input");
inputObj.name = "address";
labelObj.htmlFor = "address";
// -->
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object represents a caption for a FIELDSET
grouping. HTMLLegendElement
inherits all properties and methods of the HTMLElement
object. Table 11.21 contains a list of properties for this object.
Listing 11.192 illustrates the creation of an HTMLLegendElement
using the HTMLFormElement
object.
<html>
<script language="JavaScript"
type="text/javascript">
<!--
var legendObj = formObj.createElement("legend");
// -->
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlLegendObj.accessKey
The accessKey
property of the HTMLLegendElement
object is a single character access key to give access to the form control.
Listing 11.193 illustrates the creation of an HTMLLegendElement
using theHTMLFormElement
object and then setting its accessKey
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var legendObj = formObj.createElement("legend");
legendObj.accessKey = "L";
// -->
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlLegendObj.align
The align
property of the HTMLLegendElement
object is the text alignment relative toFIELDSET
.
Listing 11.194 illustrates the creation of an HTMLLegendElement
using theHTMLFormElement
object and then setting its align
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var legendObj = formObj.createElement("legend");
legendObj.align = "top";
// -->
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlLegendObj.form
The form
property of the HTMLLegendElement
object returns the form
element containing this control. Returns Null
if this control isn’t within the context of a form.
Listing 11.195 illustrates the creation of an HTMLLegendElement
using theHTMLFormElement
object and then reading its form
property.
<html>
<script language="JavaScript"
type="text/javascript">
<!--
var legendObj = formObj.createElement("legend");
if(legendObj.form.Name == "emailForm")
processEmailForm(legendObj.form);
// -->
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object represents an HTML list item element. HTMLLIElement
inherits all properties and methods of HTMLElement
. Table 11.22 contains a list of properties for this object.
Listing 11.196 illustrates the creation of anHTMLLIElement
using the HTMLOLElement
object.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var olObj = bodyObj.CreateElment("ol");
var liObj = olObj.createElement("li");
liObj.type = "item";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlLIObj.type
The type
property of the HTMLLIElement
object is the list item bullet style.
Listing 11.197 illustrates the creation of an HTMLLIElement
using the HTMLOLElement
object and then setting its type
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var olObj = bodyObj.CreateElement("ol");
var liObj = olObj.createElement("li");
liObj.type = "item";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlLIObj.value
The value
property of the HTMLLIelement
object resets the sequence number when used in OL
.
Listing 11.198 illustrates the creation of an HTMLLIElement
using the HTMLOLElement
object and then setting its value
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var olObj = bodyObj.CreateElment("ol");
var liObj = olObj.createElement("li");
liObj.value = "list item text";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
The LINK
element specifies a link to an external resource, and defines this document’s relationship to that resource (or vice versa). Table 11.23 contains a list of properties for this object.
Listing 11.199 illustrates the creation of an HTMLLinkElement
using the HTMLDocument
object element and then setting its href
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open(); var linkElement = htmlDoc.createElement("link");
linkElement.href = "http://foo.bar/ "; }
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlLinkObj.charset
The charset
property of the HTMLLinkElement
object is the character encoding of the resource being linked to.
Listing 11.200 illustrates the creation of and displaying the charset
property of a HTMLLinkElement
object.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc"); htmlDoc.open();
var linkElement =
htmlDoc.createElement("link"); htmlDoc.Write(linkElement.charSet);
}
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlLinkObj.disabled
The disabled
property of the HTMLLinkElement
enables/disables the link. This is currently only used for style sheet links, and can be used to activate or deactivate style sheets.
Listing 11.201 illustrates the creation of an HTMLLinkElement
using the HTMLDocument
object element and then setting its disabled
property to true.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var linkElement = htmlDoc.createElement("link");
linkElement.disabled = true;
}
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlLinkObj.href
The href
property of the HTMLLinkElement
object is the URI of the linked resource.
Listing 11.202 illustrates the creation of an HTMLLinkElement
using the HTMLDocument
object element and then setting its href
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var linkElement = htmlDoc.createElement("link");
linkElement.href = "http://foo.bar/ ";
}
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlLinkObj.hreflang
The hrefLang
property of the HTMLLinkElement
is the language code of the linked resource.
Listing 11.203 illustrates the creation of an HTMLLinkElement
using the HTMLDocument
object element and then setting its href
and hreflang
properties.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var linkElement = htmlDoc.createElement("link");
linkElement.href = "http://foo.bar/ ";
linkElement.hreflang = "us/english";
}
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlLinkObj.media
The media
property of the HTMLLinkgElement
object is designed for use with one or more target media.
Listing 11.204 illustrates the creation of a HTMLLinkElement
and setting its media
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var linkElement = htmlDoc.createElement("link");
linkElement.media = "image/jpg";
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlLink.rel
The rel
property of the HTMLLinkElement
object is the forward link type.
Listing 11.205 illustrates setting the rel
property of the HTMLLinkElement
object
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var linkElement = htmlDoc.createElement("link");
linkElement.href = "http://foo.bar/ ";
linkElement.rel = "http://foo.bar/link.html";
}
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlLinkObj.rev
The rev
property of the HTMLLinkElement
object is the reverse link type.
Listing 11.206 illustrates setting of the rev
property of the HTMLLinkElement
object.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var linkElement = htmlDoc.createElement("link");
linkElement.rev = "http://foo.bar/links.htm";
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlLinkObj.target
The target
property of the HTMLLinkElement
object is the frame to render the resource in.
Listing 11.207 illustrates the creation of an HTMLLinkElement
using the HTMLDocument
object element and setting its target
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var linkElement = htmlDoc.createElement("link");
htmlDoc.write(linkElement.target);
}
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlLinkObj.type
The type
property of the HTMLLinkElement
object is the advisory content type.
Listing 11.208 illustrates the creation of an HTMlLinkElement
using the HTMLDocument
object element and then setting its type
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var linkElement = htmlDoc.createElement("link");
linkElement.type = "text/html";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object represents an HTML element for a client-side image map. The HTMLMapElement
object inherits all methods and properties of the HTMLElement
object. Table 11.24 contains a list of properties for this object.
Listing 11.209 illustrates the creation of an HTMLMapElement
using the HTMLBodyElement
object.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var mapObj = bodyObj.createElement("map");
// -->
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlMapObj.areas
The areas
property of the HTMLMapElement
object is the list of areas defined for the image map are contained in an HTMLCollection
.
Listing 11.210 illustrates the creation of an HTMLMapElement
using the HTMLBodyElement
object and then reading its areas
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var mapObj = bodyObj.createElement("map");
var areaCollection = mapObj.areas;
// -->
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlMapObj.name
The name
property of the HTMLMapElement
object names the map (for use with UseMap).
Listing 11.211 illustrates the creation of an HTMLMapElement
using the HTMLBodyElement
object and then setting its name
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var mapObj = bodyObj.createElement("map");
mapObj.name = "mymap";
// -->
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object represents an HTML menu element. The property for this object is as follows:
Item | Description |
| Reduces line spacing between list items when true |
Listing 11.212 illustrates the creation of an HTMLMenuElement
using the HTMLBodyElement
.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var menuObj = bodyObj.createElement("menu");
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlMenuObj.compact
The compact
property of the HTMLMenuElement
object indicates whether or not to reduce spacing between list items.
Listing 11.213 illustrates the creation of an HTMLMenuElement
using the HTMLBodyElement
object and then setting its compact
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var menuObj = bodyObj.CreateElement("menu");
menuObj.compact = true;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core object represents DOM HTML object.
This object represents generic meta-information about the document.HTMLMetaElement
inherits all properties and methods from HTMLElement
. Table 11.25 contains a list of properties for this object.
Listing 11.214 illustrates the creation of an HTMLMetaElement
using the HTMLDocument
object.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var linkElement = htmlDoc.createElement("meta");
}
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlMetaDataObj.content
The content
property of the HTMLMetaDataElement
object represents associated information contained in the metadata.
Listing 11.215 illustrates the creation of an HTMLMetaElement
using the HTMLDocument
object element and then setting its content
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var metaElement = htmlDoc.createElement("meta");
metaElement.content = "text/html";
}
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlMetaDataObj.httpEquiv
The httpEquiv
property of the HTMLMetaElement
object is the HTTP response header name.
Listing 11.216 illustrates the creation of an HTMLMetaElement
using the HTMLDocument
object element and then setting its httpEquiv
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var metaElement = htmlDoc.createElement("meta");
metaElement.httpEquiv = "NO-CACHE";
}
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlMetaDataObj.name
The name
property of the HTMLMetaDataElement
object is the meta information name.
Listing 11.217 illustrates the creation of an HTMLMetaElement
using the HTMLDocument
object element and then setting its name
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var metaElement = htmlDoc.createElement("meta");
metaElement.name = "keywords";
}
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlMetaDataObj.scheme
The scheme
property of the HTMLMetaElement
object is the select form of content.
Listing 11.218 illustrates the creation of an HTMLMetaElement
using the HTMLDocument
object element and then setting its scheme
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var metaElement = htmlDoc.createElement("meta");
metaElement.scheme = "foo";
}
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object represents a notice of modification to part of a document. The HTMLModElement
object inherits all methods and properties from HTMLElement
. Table 11.26 contains a list of properties for this object.
Listing 11.219 illustrates the creation of an HTMLModElement
using the HTMLBodyElement
object.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var modObj = bodyObj.CreateElement("mod");
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlModObj. cite
The cite
property of the HTMLModElement
object is a URI designating a document that describes the reason for the change.
Listing 11.220 illustrates the creation of an HTMLModElement
using the HTMLBodyElement
object element and then setting its cite
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var modObj = bodyObj.createElement("mod");
modObj.cite = "http://foo.bar/reference.html";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlModObj. dateTime
The dateTime
property of the HTMLModElement
is the date and time of the change.
Listing 11.221 illustrates the creation of an HTMLModElement
using the HTMLBodyElement
object and then setting its dateTime
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var modObj = bodyObj.CreateElement("mod");
modObj.cite = "http://foo.bar/reference.html";
modObj.dateTime = "2/14/2001";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object represents an HTML object element. The HTMLObjectElement
object inherits all methods and properties from the HTMLElement
object. Table 11.27 contains a list of properties for this object.
Listing 11.222 illustrates the creation of an HTMLObjectElement
using the HTMLBodyElement
object and then reading its form
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var objectObj = bodyObj.createElement("object");
if(objectObj.Form.Name == "emailForm")
processEmailForm(objectObj.form);
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlObjectObj.align
The align
property of the HTMLObjectElement
object aligns this object (vertically or horizontally) with respect to its surrounding text.
Listing 11.223 illustrates the creation of an HTMLObjectElement
using the HTMLBodyElement
object and then setting its align
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var objectObj = bodyObj.createElement("object");
objectObj.align = "top";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlObjectObj.archive
The archive
property of the HTMLObjectElement
object is the space-separated list of archives.
Listing 11.224 illustrates the creation of an HTMLObjectElement
using the HTMLBodyElement
object and then setting its archive
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var objectObj = bodyObj.createElement("object");
objectObj.archive = "foo.jar";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlObjectObj.border
The border
property of the HTMLObjectElement
object is the width of border around the object.
Listing 11.225 illustrates the creation of an HTMLObjectElement
using the HTMLBodyElement
object and then setting its border
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var objectObj = bodyObj.createElement("object");
objectObj.border = 0;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlObjectObj.code
The code
property of the HTMLObjectElement
object is an applet class file. See the code
attribute for HTMLAppletElement
.
Listing 11.226 illustrates the creation of an HTMLObjectElement
using the HTMLBodyElement
object and then setting its code
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var objectObj = bodyObj.createElement("object");
objectObj.code = "classId";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlObjectObj.codeBase
The codeBase
property of the HTMLObjectElement
object is the base URI for classid
, data
, and archive
attributes.
Listing 11.227 illustrates the creation of an HTMLObjectElement
using the HTMLBodyElement
object and then setting its codeBase
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var objectObj = bodyObj.createElement("object");
objectObj.codeBase = "http://foo.bar/scripts/";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlObjectObj.codeType
The codeType
property of the HTMLObjectElement
is the content type for data downloaded via classid
attribute.
Listing 11.228 illustrates the creation of an HTMLObjectElement
using the HTMLBodyElement
object and then setting its codeType
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var objectObj = bodyObj.createElement("object");
objectObj.codeType = "x-application/flash";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlObjectObj.contentDocument
The contentDocument
property of the HTMLObjectElement
is the document this object contains, if there is any and it is available, or Null
otherwise.
Listing 11.229 illustrates the creation of an HTMLObjectElement
using the HTMLBodyElement
object and then reading its contentDocument
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = objectObj.contentDocument;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlObjectObj.data
The data
property of the HTMLObjectElement
object is a URI specifying the location of the object’s data.
Listing 11.230 illustrates the creation of an HTMLObjectElement
using the HTMLBodyElement
object.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var objectObj = bodyObj.createElement("object");
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlObjectObj.declare
The declare
property of the HTMLObjectElement
object declares (for future reference), but does not instantiate, this object.
Listing 11.231 illustrates the creation of an HTMLObjectElement
using the HTMLBodyElement
object and then setting its declare
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var objectObj = bodyObj.createElement("object");
objectObj.declare = true;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlObjectObj.form
The form
property of the HTMLObjectElement
object returns the FORM
element containing this control. Returns Null
if this control isn’t within the context of a form.
Listing 11.232 illustrates the creation of an HTMLObjectElement
using the HTMLBodyElement
object element and then reading its form
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var objectObj = bodyObj.createElement("object");
if(objectObj.form.name == "emailForm")
processEmailForm(objectObj.form);
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlObjectObj.height
The height
property of the HTMLObjectElement
object overrides the height.
Listing 11.233 illustrates the creation of an HTMLObjectElement
using the HTMLBodyElement
object and then setting its height
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var objectObj = bodyObj.createElement("object");
objectObj.height = 23;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlObjectObj.hspace
The hspace
property of the HTMLObjectElement
is the horizontal space to the left and right of this image, applet, or object.
Listing 11.234 illustrates the creation of an HTMLObjectElement
using the HTMLBodyElement
object and then setting its hspace
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var objectObj = bodyObj.createElement("object");
objectObj.hspace = 1;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlObjectObj.name
The name
property of the HTMLObjectElement
object is the form control or object name when submitted with a form.
Listing 11.235 illustrates the creation of an HTMLObjectElement
using the HTMLBodyElement
object and then setting its name
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var objectObj = bodyObj.createElement("object");
objectObj.name = "myobject";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlObjectObj.standby
The standby
property of the HTMLObjectElement
object is the message to render while loading the object.
Listing 11.236 illustrates the creation of an HTMLObjectElement
using the HTMLBodyelement
object and then setting its standby
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var objectObj = bodyObj.createElement("object");
objectObj.standby = "Please wait while loading object.";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlObjectObj.tabIndex
The tabIndex
property of the HTMLObjectElement
is the index that represents the element’s position in the tabbing order.
Listing 11.237 illustrates the creation of an HTMLObjectElement
using the HTMLBodyElement
object and then setting its tabIndex
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var objectObj = bodyObj.createElement("object");
objectObj.tabIndex = 3;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlObjectObj.type
The type
property of the HTMLObjectElement
object is the content type for data downloaded via data attribute.
Listing 11.238 illustrates the creation of an HTMLObjectElement
using the HTMLBodyElement
object and then setting its type
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var objectObj = bodyObj.createElement("object");
objectObj.type = "applicationType";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlObjectObj.useMap
The useMap
property of the HTMLObjectElement
object indicates whether or not to use a client-side image map.
Listing 11.239 illustrates the creation of an HTMLObjectElement
using the HTMLBodyElement
object and then setting its useMap
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var objectObj = bodyObj.createElement("object");
objectObj.useMap = true;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlObjectObj.vspace
The vspace
property of the HTMLObjectElement
object is the vertical space above and below this image, applet, or object.
Listing 11.240 illustrates the creation of an HTMLObjectElement
using the HTMLBodyElement
object and then setting its vspace
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var objectObj = bodyObj.createElement("object");
objectObj.vspace = 2;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlObjectObj.width
The width
property of the HTMLObjectElement
object overrides the width of the object.
Listing 11.241 illustrates the creation of an HTMLObjectElement
using the HTMLBodyElement
object and then setting its width
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var objectObj = bodyObj.createElement("object");
objectObj.width = 20;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object represents an HTML ordered list element. The HTMLOListElement
object inherits all methods and properties of the HTMLElement
object. Table 11.28 contains a list of properties for this object.
Listing 11.242 illustrates the creation of an HTMLOListElement
using the HTMLBodyElement
object.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var olObj = bodyObj.CreateElement("ol");
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlOListObj.compact
The compact
property of the HTMLOListElement
object reduces spacing between list items.
Listing 11.243 illustrates the creation of an HTMLOListElement
using the HTMLBodyElement
object and then setting its compact
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var olObj = bodyObj.CreateElement("ol");
olObj.compact = true;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlOListObj.start
The start
property of the HTMLOListElement
object is the starting sequence number.
Listing 11.244 illustrates the creation of an HTMLOListElement
using the HTMLBodyElement
object and then setting its start
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var olObj = bodyObj.CreateElement("ol");
olObj.start = 1;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlOListObj.type
The type
property of the HTMLOListElement
object indicates its numbering style.
Listing 11.245 illustrates the creation of an HTMLOListElement
using the HTMLBodyElement
object and then setting its type
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var olObj = bodyObj.CreateElement("ol");
olObj.type = "ascending";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
Group options together in logical subdivisions. This object inherits all methods and properties from HTMLElement
. Table 11.29 contains a list of properties for this object.
Listing 11.246 illustrates the creation of an HTMLOptGroupElement
using the HTMLSelectElement
object.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectElement = formObj.createElement("select");
var optionGrp = selectElement.createElement("options");
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlOptGroupObj.disabled
The disabled
property of the HTMLOptGroupElement
is used to disable the option group of elements.
Listing 11.247 illustrates the creation of an HTMLOptGroupElement
using the HTMLSelectElement
object and then setting its disabled
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectElement = formObj.createElement("select");
var optionGrp = selectElement.createElement("options");
optionGrp.disabled = true;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlOptGroupObj.label
The label
property of the HTMLOptGroupElement
assigns a label to this option group.
Listing 11.248 illustrates the creation of an HTMLOptGroupElement
using the HTMLSelectElement
object and then setting its label
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectElement = formObj.createElement("select");
var optionGrp = selectElement.createElement("options");
optionGrp.label = "Colors";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object represents an HTML option element that resized in a select element. This object inherits all methods and properties from HTMLElement
. Table 11.30 contains a list of properties for this object.
Listing 11.249 illustrates the creation of an HTMLOptionElement
using the HTMLOptGroupElement
object.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectElement = formObj.createElement("select");
var optionGrp = selectElement.createElement("options");
var optionElement = optionGrp.createElement("option");
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlOptionObj.defaultSelected
The defaultSelected
property of the HTMLOptionElement
object represents the value of the HTML selected attribute. The value of this attribute doesn’t change if the state of the corresponding form control, in an interactive user agent, changes. Changing defaultSelected
, however, resets the state of the form control.
Listing 11.250 illustrates the creation of an HTMLOptionElement
using the HTMLOptGroupElement
object and then setting its defaultSelected
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectElement = formObj.createElement("select");
var optionGrp = selectElement.createElement("options");
var optionElement = optionGrp.createElement("option");
optionElement.defaultSelected = true;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlOptionObj.disabled
The disabled
property of the HTMLOptionElement
object is used to disable the option instance.
Listing 11.251 illustrates the creation of an HTMLOptionElement
using the HTMLSelectElement
object and then setting its disabled
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectElement = formObj.createElement("select");
var optionGrp = selectElement.createElement("options");
var optionElement = optionGrp.createElement("option");
optionElement.disabled = true;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlOptionObj.form
The form
property of the HTMLOptionElement
object returns the FORM
element containing this control. Returns Null
if this control isn’t within the context of a form.
Listing 11.252 illustrates the creation of an HTMLOptionElement
using the HTMLSelectElement
object and then reading its form
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectElement = formObj.createElement("select");
var optionGrp = selectElement.createElement("options");
var optionElement = optionGrp.createElement("option");
if(optionElement.form == "myForm")
processOption(optionElement);
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlOptionObj.index
The index
property of the HTMLOptionElement
object is the index of this option in its parent SELECT
, starting from 0
.
Listing 11.253 illustrates the creation of an HTMLOptionElement
using the HTMLSelectElement
object and then reading its index
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectElement = formObj.createElement("select");
var optionGrp = selectElement.createElement("options");
var optionElement = optionGrp.createElement("option");
if(optionElement.index == 0)
processFirstOption(optionElement);
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlOptionObj.label
The label
property of the HTMLOptionElement
object is the option label for use in hierarchical menus.
Listing 11.254 illustrates the creation of an HTMLOptionElement
using the HTMLSelectElement
object and then setting its label
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectElement = formObj.createElement("select");
var optionGrp = selectElement.createElement("options");
var optionElement = optionGrp.createElement("option");
optionElement.label = "Green";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlOptionObj.selected
The selected
property of the HTMLOptionElement
object represents the current state of the corresponding form control, in an interactive user agent. Changing this attribute changes the state of the form control, but does not change the value of the HTML selected attribute of the element.
Listing 11.255 illustrates the creation of an HTMLOptionElement
using the HTMLSelectElement
object and then setting its selected
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectElement = formObj.createElement("select");
var optionGrp = selectElement.createElement("options");
var optionElement = optionGrp.createElement("option");
optionElement.selected = "true";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlOptionObj. text
The text
property of the HTMLOptionElement
object is the text contained within the option element.
Listing 11.256 illustrates the creation of an HTMLOptionElement
using the HTMLSelectElement
object and then setting its text
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectElement = formObj.createElement("select");
var optionGrp = selectElement.createElement("options");
var optionElement = optionGrp.createElement("option");
var optionElement.text = "Blue";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlOptionObj. value
The value
property of the HTMLOptionElement
object is the current form control value.
Listing 11.257 illustrates the creation of an HTMLOptionElement
using the HTMLSelectElement
object and then setting its value
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectElement = formObj.createElement("select");
var optionGrp = selectElement.createElement("options");
var optionElement = optionGrp.createElement("option");
optionElement.value = "g";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object represents an HTML paragraph element. The HTMLParagraph
element inherits all methods and properties of the HTMLElement
object. The property for this object is as follows:
Listing 11.258 illustrates the creation of an HTMLParagraphElement
using the HTMLBodyElement
object and then setting its align
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var paragraphObj = bodyObj.CreateElement("p");
paragraphObj.align = "top";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlParagraphObj.align
The align
property of the HTMLParagraphElement
object is the horizontal text alignment.
Listing 11.259 illustrates the creation of an HTMLParagraphElement
using the HTMLBodyElement
object and then setting its align
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var paragraphObj = bodyObj.CreateElement("p");
paragraphObj.align = "bottom";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object represents an HTML parameter element. The HTMLParamElement
object inherits all methods and properties of the HTMLElement
object. Table 11.31 contains a list of properties for this object.
Listing 11.260 illustrates the creation of an HTMLParamElement
using the HTMLMetaElement
object.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var metaObj = bodyObj.createElement("meta");
var paramObj = metaObj.createElement("param");
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlParamObj.name
The name
property of the HTMLParamElement
object is the name of a runtime parameter.
Listing 11.261 illustrates the creation of an HTMLParamElement
using the HTMLMetaElement
object and then setting its name
.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var metaObj = bodyObj.createElement("meta");
var paramObj = metaObj.createElement("param");
paramObj.name = "keywords"
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlParamObj.type
The type
property of the HTMLParamElement
is the content type for the value attribute when valuetype has the value "ref"
.
Listing 11.262 illustrates the creation of an HTMLParamElement
using the HTMLMetaElement
object and then setting its name
, value
, and type
properties.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var metaObj = bodyObj.createElement("meta");
var paramObj = metaObj.createElement("param");
paramObj.name = "keywords"
paramObj.value = "horses,cows,sheep";
paramObj.type = "animals";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlParamObj.value
The value
property of the HTMLParamElement
object is the value of a runtime parameter.
Listing 11.263 illustrates the creation of an HTMLParamElement
using the HTMLMetaElement
object and then setting its value
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var metaObj = bodyObj.createElement("meta");
var paramObj = metaObj.createElement("param");
paramObj.value = "horses,cows,sheep";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlParamObj.valueType
The valueType
property of the HTMLParamElement
object is information about the meaning of the value attribute value.
Listing 11.264 illustrates the creation of an HTMLParamElement
using the HTMLMetaElement
object element and then setting its valueType
and name
properties.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var metaObj = bodyObj.createElement("meta");
var paramObj = metaObj.createElement("param");
paramObj.name = "keywords"
paramObj.valueType = "ref";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object represents an HTML pre-formatted text element. The HTMLPreElement
inherits all properties and methods of HTMLElement
. The property for this object is as follows:
Listing 11.265 illustrates the creation of an HTMLPreElement
using the HTMLBodyElement
object.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var preObj = bodyObj.createElement("pre");
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlPreObj.width
The width
property of the HTMLPreElement
object is the fixed width for content.
Listing 11.266 illustrates the creation of an HTMLPreElement
using the HTMLBodyElement
object and then setting its width
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var preObj = bodyObj.CreateElement("pre");
preObj.width = 25;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object represents both HTML Q and BLOCKQUOTE elements. The HTMLQuoteElement
inherits all properties and methods from HTMLElement
. The property for this object is as follows:
Listing 11.267 illustrates the creation of an HTMLQuoteElement
using the HTMLBodyElement
object.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var quoteObj = bodyObj.CreateElment("quote");
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlQuoteObj.cite
The cite
property of the HTMLQuoteElement
object is a URI designating a source document or message.
Listing 11.268 illustrates the creation of an HTMLQuoteElement
using the HTMLBodyElement
object and then setting its cite
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var quoteObj = bodyObj.CreateElement("quote");
quoteObj.cite = "http://foo.bar/reference.html";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object represents an HTML script element. HTMLScriptElement
inherits all properties and methods from the HTMLElement
object. Table 11.32 contains a list of properties for this object.
Listing 11.269 illustrates the creation of an HTMLScriptElement
using the HTMLBodyElement
object and then setting its text
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var scriptObj = bodyObj.createElement("script");
scriptObj.text = "some script text";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlScriptObj.charset
The charset
property of the HTMLScriptElement
object is the character encoding of the linked resource.
Listing 11.270 illustrates the creation of an HTMLScriptElement
using the HTMLBodyElement
object and then setting its charset
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var scriptObj = bodyObj.createElement("script");
scriptObj.charset = "us/english";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlScriptObj.defer
The defer
property of the HTMLScriptElement
object indicates that the user agent can defer processing of the script.
Listing 11.271 illustrates the creation of an HTMLScriptElement
using the HTMLBodyElement
object and then setting its defer
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var scriptObj = bodyObj.createElement("script");
scriptObj.defer = true;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5.0+
Nav6+, IE5+
htmlScript.event
The event
property of the HTMLScriptElement
object is reserved for future use.
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlScriptObj.htmlFor
The htmlFor
property of the HTMLScriptElement
object is reserved for future use.
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlScriptObj.src
The src
property of the HTMLScriptElement
object is a URI designating an external script.
Listing 11.272 illustrates the creation of an HTMLScriptElement
using the HTMLBodyElement
object.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var scriptObj = bodyObj.createElement("script");
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlScriptObj.text
The text
property of the HTMLScriptElement
object is the script content of the element.
Listing 11.273 illustrates the creation of an HTMLScriptElement
using the HTMLBodyElement
object element and then setting its text
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var scriptObj = bodyObj.createElement("script");
scriptObj.text = "some script text";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlScriptObj.type
The type
property of the HTMLScriptElement
is the content type of the script language.
Listing 11.274 illustrates the creation of an HTMLScriptElement
using the HTMLBodyElement
object and then setting its type
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var scriptObj = bodyObj.createElement("script");
scriptObj.type = "text/html";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
The select element allows the selection of an option. The contained options can be directly accessed through the select element as a collection. This object inherits all methods and properties from HTMLElement
. Table 11.33 contains a list of properties and methods for this object.
Listing 11.275 illustrates the creation of an HTMLSelectElement
using the HTMLFormElement
object.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectElement = formObj.createElement("select");
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlSelectObj.add(element, before)
The add()
method of the HTMLSelectElement
object adds a new element to the collection of OPTION
elements for this SELECT
. This method is equivalent to the AppendChild()
method of the Node
object if the before parameter is Null
. It is equivalent to the InsertBefore()
method on the parent of before
in all other cases.
Listing 11.276 illustrates the creation of a HTMLSelectElement
and invoking its add()
method.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectObj = formObj.createElement("select");
var optionObj = htmlDoc.createElement("option");
selectObj.add(optionObj, null);
// -->
<script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlSelectObj.blur()
The blur()
method of the HTMLSelectElement
object removes keyboard focus from this element.
Listing 11.277 illustrates the creation of a HTMLSelectElement
and invoking its blur()
method.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectObj = formObj.createElement("select");
selectObj.blur();
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlSelectObj.disabled
The disabled
property of the HTMLSelectElement
object is used to disable the select element instance.
Listing 11.278 illustrates the creation of an HTMLSelectElement
using an HTMLFormElement
object and setting its disabled
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectObj = formObj.createElement("select");
selectObj.disabled = true;
}
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlSelectObj.focus()
The focus()
method of the HTMLSelectElement
object gives keyboard focus to this element.
Listing 11.279 illustrates the creation of a HTMLSelectElement
and invoking its focus()
method.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectObj = formObj.createElement("select");
selectObj.focus()
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlSelectObj.form
The form
property of the HTMLSelectElement
object returns the FORM
element containing this control. Returns Null
if this control isn’t within the context of a form.
Listing 11.280 illustrates the reading an HTMLSelectElement
’s form
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
function submitFormFromSelect(selectObj) {
var formObj = selectObj.form;
formObj.submit();
}
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlSelectObj.length
The length
property of the HTMLSelectElement
object is the number of options in this SELECT
.
Listing 11.281 illustrates the creation of a HTMLSelectObject
and reading its length
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectObj = formObj.createElement("select");
var optionList = selectObj.options;
var i = 0;
while( i < selectObj.length) {
processOption(optionList.index(i));
i++;
}
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlSelectObj.multiple
The multiple
property of the HTMLSelectElement
object indicates whether or not multiple OPTION
elements can be selected in this SELECT
.
Listing 11.282 illustrates the creation of a HTMLSelectElement
and setting its multiple
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectObj = formObj.createElement("select");
selectObj.multiple = true;
}
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlSelectObj.name
The name
property of the HTMLSelectElement
object is the form control or object name when submitted with a form.
Listing 11.283 illustrates the creation of a HTMLSelectElement
and setting its name
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectObj = formObj.createElement("select");
selectObj.name = "Color Selection";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlSelectObj.options
The options
property of the HTMLSelectElement
object is the collection of OPTION
elements contained by this element.
Listing 11.284 illustrates the creation of a HTMLSelectElement
and iterating through its options
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectObj = formObj.createElement("select");
var optionList = selectObj.options;
var i = 0;
while( i < selectObj.length) {
processOption(optionList.index(i));
i++;
}
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlSelectObj.remove(index)
The remove()
method of the HTMLSelectElement
object removes an element from the collection of OPTION
elements for this SELECT
. Does nothing if no element has the given index.
Listing 11.285 illustrates the creation of a HTMLSelectElement
and invoking its remove()
method.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectObj = formObj.createElement("select");
selectObj.remove(selectObj.selectedIndex);
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlSelectObj.selectedIndex
The selectedIndex
property of the HTMLSelectElement
object is the ordinal index of the selected option, starting from 0
. The value -1
is returned if no element is selected. If multiple options are selected, the index of the first selected option is returned.
Listing 11.286 illustrates the creation of an HTMLSelectElement
using the HTMLFormElement
object and then setting its selectedIndex
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectObj = formObj.createElement("select");
var optionObj = htmlDoc.createElement("option");
selectObj.Add(optionObj);
selectObj.selectedIndex = 0;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlSelectObj.size
The size
property of the HTMLSelectElement
object is the number of visible rows.
Listing 11.287 illustrates the creation of an HTMLSelectElement
and setting its size
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectObj = formObj.createElement("select");
selectObj.size = 20;
}
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlSelectObj.tabIndex
The tabIndex
property of the HTMLSelectElement
is the index that represents the element’s position in the tabbing order.
Listing 11.288 illustrates the creation of an HTMLSelectElement
and setting its tabIndex
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectObj = formObj.createElement("select");
selectObj.tabIndex = 4;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlSelectObj.type
The type
property of the HTMLSelectElement
object is the type of this form control. This is the string "select-multiple"
when the multiple attribute is True
and the string "select-one"
when False
.
Listing 11.289 illustrates the creation of an HTMLSelectElement
using the HTMLFormElement
object and then setting its type
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj=createElement("form");
var selectObj = formObj=createElement("select");
selectObj.type = "select-multiple";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlSelectObj.value
The value
property of the HTMLSelectElement
object is the current form control value.
Listing 11.290 illustrates the creation of an HTMLSelectElement
using the HTMLFormElement
object and then setting its value
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var bodyObj = htmlDoc.createElement("body");
var formObj = bodyObj.createElement("form");
var selectObj = formObj.createElement("select");
selectObj.value = "selection text";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
Represents style information contained in a style sheet. HTMLStyleElement
inherits all methods and properties from HTMLElement
. Table 11.34 contains a list of properties for this object.
Listing 11.291 illustrates the creation of an HTMLStyleElement
using the HTMLDocument
.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var styleObj = htmlDoc.createElement("style");
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
styleInfoObj.disabled
The disabled
property of the HTMLStyleElement
enables/disables the style sheet.
Listing 11.292 illustrates the creation of an HTMLStyleObject
using the HTMLDocument
object element and then disabling it.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var styleObj = htmlDoc.createElement("style");
styleObj.disabled = true;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
styleInfoObj.media
The media
property of the HTMLStyleElement
object is designed for use with one or more target media.
Listing 11.293 illustrates the creation of an HTMLStyleObject
using the HTMLDocument
object element and then setting its media
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var styleObj = htmlDoc.createElement("style");
styleObj.media = "jpg";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
styleInfoObj.type
The type
property of the HTMLStyleElement
object is the content type of the style sheet language.
Listing 11.294 illustrates the creation of an HTMLStyleObject
using the HTMLDocument
object element and then setting its type
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var styleObj = htmlDoc.createElement("style");
styleObj.type = "text/html";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object represents an HTML table caption element. HTMLTableCaptionElement
inherits all properties and methods from HTMLElement
. The property for this object is as follows:
Item | Description |
| Aligns caption with respect to the table it resides in |
Listing 11.295 illustrates the creation of an HTMLTableCaptionElement
using the HTMLTableElement
object.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
var captionObj = tableObj.createCaption();
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableCaptionObj.align
The align
property of the HTMLTableCaptionElement
is the caption alignment with respect to the table.
Listing 11.296 illustrates the creation of an HTMLTableCaptionElement
using the HTMLTableElement
object and then setting its align
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
var captionObj = tableObj.createCaption();
captionObj.align = "top";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object is used to represent the TH and TD elements. The HTMLTableCellElement
object inherits all methods and properties from the HTMLElement
object. Table 11.35 contains a list of properties for this object.
Listing 11.297 illustrates the creation of an HTMLTableCellElement
using the insertRow()
method of the HTMLTableRowElement
object.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var rowObj = tableObj.insertRow(1);
var cellObj = rowObj.insertCell(2);
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableCellObj.abbr
The abbr
property of the HTMLTableCellElement
object is an abbreviation for header cells.
Listing 11.298 illustrates the creation of an HTMLTableCellElement
using the HTMLTableRowElement
object and then setting its abbr
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var rowObj = tableObj.insertRow(1);
var cellObj = rowObj.insertCell(1);
cellObj.abbr = "Admin";
// -->
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableCellObj.align
The align
property of the HTMLTableCellElement
object is the horizontal alignment of data in cell.
Listing 11.299 illustrates the creation of an HTMLTableCellElement
using the HTMLTableRow
object and then setting its align
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
cellObj.align = "center";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableCellObj.axis
The axis
property of the HTMLTableCellElement
object names group of related headers.
Listing 11.300 illustrates the creation of an HTMLTableCellElement
and then setting its axis
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
cellObj.axis = "Colors";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableCellObj.bgColor
The bgColor
property of the HTMLTableCellElement
object is the cell background color.
Listing 11.301 illustrates the creation of an HTMLTableCellElement
and then setting its bgColor
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
cellObj.bgColor = "blue";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableCellObj.cellIndex
The cellIndex
property of the HTMLTableCellElement
object is the index of this cell in the row, starting from 0
. This index is in document tree order and not display order.
Listing 11.302 illustrates the creation of an HTMLTableCellElement
and then reading its cellIndex
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
if(cellObj.cellIndex == 1)
handleFirstCell(cellObj);
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableCellObj.ch
The ch
property of the HTMLTableCellElement
object is the alignment character for cells in a column.
Listing 11.303 illustrates the creation of an HTMLTableCellElement
and then setting its ch
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
cellObj.ch = ".";
// -->
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableCellObj.chOff
The chOff
property of the HTMLTableCellElement
object is the offset of alignment character.
Listing 11.304 illustrates the creation of an HTMLTableCellElement
and then setting its chOff
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
cellObj.chOff = "1";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableCellObj.colSpan
The colSpan
property of the HTMLTableCellElement
object is the number of columns spanned by cell.
Listing 11.305 illustrates the creation of an HTMLTableCellElement
and then setting its colSpan
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
cellObj.colSpan = 3;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableCellObj.headers
The headers
property of the HTMLTableCellElement
object is a list of id
attribute values for header cells.
Listing 11.306 illustrates the creation of an HTMLTableCellElement
and then setting its headers
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
cellObj.headers = "foo,bar";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableCellObj.height
The height
property of the HTMLTableCellElement
object is the cell height.
Listing 11.307 illustrates the creation of an HTMLTableCellElement
and then setting its height
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
cellObj.height = 25;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableCellObj.noWrap
The noWrap
property of the HTMLTableCellElement
object Suppresses word wrapping when true.
Listing 11.308 illustrates the creation of an HTMLTableCellElement
and then setting its noWrap
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
cellObj.noWrap = true;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableCellObj.rowSpan
The rowSpan
property of the HTMLTableCellElement
object is the number of rows spanned by cell.
Listing 11.309 illustrates the creation of an HTMLTableCellElement
and then setting its rowSpan
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
cellObj.rowSpan = 3;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableCellObj.scope
The scope
property of the HTMLTableCellElement
object is the scope covered by header cells.
Listing 11.310 illustrates the creation of an HTMLTableCellElement
and then setting its scope
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
cellObj.scope = "row";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableCellObj.vAlign
the vAlign
property of the HTMLTableCellElement
object is the vertical alignment of data in cell.
Listing 11.311 illustrates the creation of an HTMLTableCellElement
and then setting its vAlign
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
cellObj.vAlign = "top";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableCellObj.width
The width
property of the HTMLTableCellElement
object is the cell width.
Listing 11.312 illustrates the creation of an HTMLTableCellElement
and then setting its width
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
cellObj.width = 35;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object represents both the HTML COL and COLGROUP elements. HTMLTableColElement
object inherits all properties and methods from HTMLElement
. Table 11.36 contains a list of properties for this object.
Listing 11.313 illustrates the creation of an HTMLTableColElement
using the HTMLTableRowElement
object.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
var rowObj = tableObj.insertRow(2);
var columnObj = rowObj.createElement("td");
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableColObj.align
The The align
property of the HTMLTableColElement
object is the horizontal alignment of cell data in column.
Listing 11.314 illustrates the creation of an HTMLTableColElement
using the HTMLTableRowElement
object and then setting its align
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
var rowObj = tableObj.insertRow(2);
var columnObj = rowObj.createElement("td");
columnObj.align = "center";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableColObject.ch
The ch
property of the HTMLTableColElement
object is the alignment character for cells in a column.
Listing 11.315 illustrates the creation of an HTMLTableColElement
using the HTMLTableRowElement
object and then setting its ch
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
var rowObj = tableObj.insertRow(2);
var columnObj = rowObj.createElement("td");
columnObj.align = "char";
columnObj.ch = ".";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableColObject.chOff
The chOff
property of the HTMLTableColElement
object is the offset of alignment character.
Listing 11.316 illustrates the creation of an HTMLTableColElement
using the HTMLTableRowElement
object element and then setting its chOff
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
var rowObj = tableObj.insertRow(2);
var columnObj = rowObj.createElement("col");
columnObj.align = "char";
columnObj.chOff = 3;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableColObj.span
The span
property of the HTMLTableColElement
object indicates the number of columns in a group or affected by a grouping.
Listing 11.317 illustrates the creation of an HTMLTableColElement
using the HTMLTableRowElement
object and then setting its span
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
var rowObj = tableObj.insertRow(2);
var columnObj = rowObj.createElement("col");
columnObj.span = 3;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableColObj.vAlign
The vAlign
property of the HTMLTableColElement
object is the vertical alignment of cell data in column.
Listing 11.318 illustrates the creation of an HTMLTableColElement
using the HTMLTableRowElement
object and then setting its vAlign
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
var rowObj = tableObj.insertRow(2);
var columnObj = rowObj.createElement("td");
columnObj.vAlign = "top";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableColObj.width
The width
property of the HTMLTableColElement
object is the default column width.
Listing 11.319 illustrates the creation of an HTMLTableColElement
using the HTMLTableRowElement
object element and then setting its width
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
var rowObj = tableObj.insertRow(2);
var columnObj = rowObj.createElement("td");
columnObj.width = 44;
// -->
<script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object represents an HTML table element. HTMLTableElement
inherits all properties and methods from the HTMLElement
object. Table 11.37 contains a list of properties and methods for this object.
Listing 11.320 illustrates the creation of an HTMLTableElement
using the HTMLBodyElement
object and then setting its caption
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
tableObj.caption = "My Table";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObj.align
The align
property of the HTMLTableElement
object specifies the table’s position with respect to the rest of the document.
Listing 11.321 illustrates the creation of an HTMLTableElement
using the HTMLBodyElement
object and then setting its align
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
tableObj.align = "top";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObj.bgColor
The bgColor
property of the HTMLTableElement
object is the cell background color.
Listing 11.322 illustrates the creation of an HTMLTableElement
using the HTMLBodyElement
object and then setting its bgColor
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
tableObj.bgColor = "#000000";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObj.border
The border
property of the HTMLTableElement
object is the width of the border around the table.
Listing 11.323 illustrates the creation of an HTMLTableElement
using the HTMLBodyElement
object and then setting its border
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
tableObj.border = 1;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObj.caption
The caption
property of the HTMLTableElement
object returns the table’s CAPTION
, or void
if none exists.
Listing 11.324 illustrates the creation of an HTMLTableElement
using the HTMLBodyElement
object and then setting its caption
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
tableObj.caption = "My Table";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObj.cellPadding
The cellPadding
property of the HTMLTableElement
object specifies the horizontal and vertical space between cell content and cell borders.
Listing 11.325 illustrates the creation of an HTMLTableElement
using the HTMLBodyElement
object and then setting its cellPadding
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
tableObj.cellPadding = 0;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObj.cellSpacing
The cellSpacing
property of the HTMLTableElement
object specifies the horizontal and vertical separation between cells.
Listing 11.326 illustrates the creation of an HTMLTableElement
using the HTMLBodyElement
object and then setting its cellSpacing
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
tableObj.cellSpacing = 2;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObj.createCaption()
The createCaption()
method of the HTMLTableElement
object creates a new table caption object or return an existing one.
Listing 11.327 illustrates the creation of an HTMLTableElement
using the HTMLBodyElement
object and then the invocation of its creatCaption()
method.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
var captionObj = tableObj.createCaption();
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObj.createTFoot()
The createTFoot()
method of the HTMLTableElement
object creates a table footer row or return an existing one.
Listing 11.328 illustrates the creation of an HTMLTableElement
using the HTMLBodyElement
object element and then the invocation of its createTFoot()
method.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
var tFootObj = tableObj.createTFoot();
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObj.createTHead()
The createTHead()
method of the HTMLTableElement
object
Listing 11.329 illustrates the creation of an HTMLTableElement
using the HTMLBodyElement
object and then the invocation of its createTHead()
method.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
var tHeadObj = tableObj.createTHead();
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObj.deleteCaption()
The deleteCaption()
method of the HTMLTableElement
object deletes the table caption, if one exists.
Listing 11.330 illustrates the creation of an HTMLTableElement
using the HTMLBodyElement
object and then the invocation of its deleteCaption()
method.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
tableObj.deleteCaption();
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObj.deleteRow(index)
The deleteRow()
method of the HTMLTableElement
object deletes the index table row.
Listing 11.331 illustrates the creation of an HTMLTableElement
using the HTMLBodyElement
object and then the invocation of its deleteRow()
method.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
tableObj.deleteRow(1);
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObj.deleteTFoot()
The deleteTFoot()
method of the HTMLTableElement
object deletes the footer from the table, if one exists.
Listing 11.332 illustrates the creation of an HTMLTableElement
using the HTMLBodyElement
object and then the invocation of its deleteTFoot()
method.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.CreateElement("table");
tableObj.deleteTFoot();
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObj.deleteTHead()
The deleteTHead()
method of the HTMLTableElement
object deletes the header from the table, if one exists.
Listing 11.333 illustrates the creation of an HTMLTableElement
using the HTMLBodyElement
object and then the invocation of its deleteTHead()
method.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
tableObj.deleteTHead();
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObj.frame
The frame
property of the HTMLTableElement
object specifies which external table borders to render.
Listing 11.334 illustrates the creation of an HTMLTableElement
using the HTMLBodyElement
object and then setting its frame
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
tableObj.frame = "box";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObj.insertRow(index)
The insertRow()
method of the HTMLTableElement
object inserts a new empty row in the table. The new row is inserted immediately before and in the same section as the current index row in the table. If index
is equal to the number of rows, the new row is appended. In addition, when the table is empty, the row is inserted into a TBODY
that is created and inserted into the table.
Listing 11.335 illustrates the creation of an HTMLTableElement
using the HTMLBodyElement
object and then the invocation of its insertRow()
method.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
var rowObj = tableObj.insertRow(1);
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObject.rows
The rows
property of the HTMLTableElement
object returns a collection of all the rows in the table, including all in THEAD
, TFOOT
, and TBODY
elements.
Listing 11.336 illustrates the creation of an HTMLTableElement
and then reading its rows
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var rowsCollection = tableObj.rows;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObj.rules
The rules
property of the HTMLTableElement
object specifies which internal table borders to render.
Listing 11.337 illustrates the creation of an HTMLTableElement
using the HTMLBodyElement
object and then setting its rules
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
tableObj.rules = "all";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObj.summary
The summary
property of the HTMLTableElement
object is a description about the purpose or structure of a table.
Listing 11.338 illustrates the creation of an HTMLTableElement
using the HTMLBodyElement
object and then setting its summary
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
tableObj.summary = "This table has no purpose";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObj.tBodies
The tBodies
property of the HTMLTableElement
object returns a collection of the defined table bodies.
Listing 11.339 illustrates the creation of an HTMLTableElement
and then reading its tBodies
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tBodiesCollection = tableObj.tBodies;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObj.tFoot
The tFoot
property of the HTMLTableElement
object returns the table’s TFOOT
, or Null
if none exists.
Listing 11.340 illustrates the creation of an HTMLTableElement
using the HTMLBodyElement
object and then reading its tFoot
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
tableObj.tFoot;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObj.tHead
The tHead
property of the HTMLTableElement
object returns the table’s THEAD
, or Null
if none exists.
Listing 11.341 illustrates the creation of an HTMLTableElement
using the HTMLBodyElement
object and then reading its tHead
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
tableObj.tHead;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableObj.width
The width
property of the HTMLTableElement
object specifies the desired table width.
Listing 11.342 illustrates the creation of an HTMLTableElement
using the HTMLBodyElement
object and then setting its width
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableObj = bodyObj.createElement("table");
tableObj.width = "100%";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object represents a row in an HTML table element. HTMLTableRowElement
inherits all methods and properties from HTMLElement
. Table 11.38 contains a list of properties and methods for this object.
Listing 11.343 illustrates the creation of an HTMLTableRowElement
using the HTMLTableElement
object’s insertRow()
method.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var rowObj = tableObj.insertRow(1);
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableRowObj.align
The align
property of the HTMLTableRowElement
object is the horizontal alignment of data within cells of this row.
Listing 11.344 illustrates the creation of an HTMLTableRowElement
using the HTMLTableElement
object and then setting its align
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var rowObj = tableObj.insertRow(1); rowObj.align = "left";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableRowObj.bgColor
The bgColor
property of the HTMLTableRowElement
object is the background color for rows.
Listing 11.345 illustrates the creation of an HTMLTableRowElement
using the HTMLTableElement
object and then setting its bgColor
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var rowObj = tableObj.insertRow(1); rowObj.bgColor = "red";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableRowObj.cells
The cells property
of the HTMLTableRowElement
object is the collection of cells in this row.
Listing 11.346 illustrates the creation of an HTMLTableRowElement
and then reading its cells
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var tableCellsCollection = rowObj.cells;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableRowObj.ch
The ch
property of the HTMLTableRowElement
object is the alignment character for cells in a column.
Listing 11.347 illustrates the creation of an HTMLTableRowElement
using the HTMLTableElement
object and then setting its ch
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var rowObj = tableObj.insertRow(1);
rowObj.align = "char";
rowObj.ch = ".";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableRowObj.chOff
The chOff
property of the HTMLTableRowElement
object is the offset of alignment character.
Listing 11.348 illustrates the creation of an HTMLTableRowElement
using the HTMLTableElement
object and then setting its chOff
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var rowObj = tableObj.insertRow(1);
rowObj.chOff = "3";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableRowObj.deleteCell(index
)
The deleteCell()
method of the HTMLTableRowElement
object deletes a cell from the current row.
Listing 11.349 illustrates the creation of an HTMLTableRowElement
and then invokes its deleteCell()
method.
<html>
<script language="JavaScript" type="text/javascript">
<!--rowObj.deleteCell(1);
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableRowObj.insertCell(index)
The insertCell()
method of the HTMLTableRowElement
object inserted an empty TD cell into this row. If index
is equal to the number of cells, the new cell is appended.
Listing 11.350 illustrates the creation of an HTMLTableRowElement
using the HTMLTableElement
object and then the invocation of its insertCell()
method.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var rowObj = tableObj.insertRow(1);
var cellObj = rowObj.insertCell(2);
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableRowObj.rowIndex
The rowIndex
property of the HTMLTableRowElement
object is the index of this row, relative to the entire table, starting from 0. This is in document tree order and not display order. The rowIndex
does not take into account sections (THEAD
, TFOOT
, or TBODY
) within the table.
Listing 11.351 illustrates the creation of an HTMLTableRowElement
using the HTMLTableElement
object element and then reading its rowIndex
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--if(rowObj.rowIndex == 1) handleFirstRow(rowObj);
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableRowObj.sectionRowIndex
The sectionRowIndex
property of the HTMLTableRowElement
object is the index of this row, relative to the current section (THEAD
, TFOOT
, or TBODY
), starting from 0.
Listing 11.352 illustrates the creation of an HTMLTableRowElement
and then reading its sectionRowIndex
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--if(rowObj.sectionRowIndex == 1) handleFirstSectionRow(rowObj);
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableRowObj.vAlign
The vAlign
property of the HTMLTableRowElement
object is the vertical alignment of data within cells of this row.
Listing 11.353 illustrates the creation of an HTMLTableRowElement
using the HTMLTableElement
object and then setting its vAlign
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var rowObj = tableObj.insertRow(1); rowObj.vAlign = "top";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object represents the HTML elements THEAD
, TFOOT
, and TBODY
. The HTMLTableSectionElement
object inherits all methods and properties from HTMLElement
. Table 11.39 contains a list of properties and methods for this object.
Listing 11.354 illustrates the creation of an HTMLTableSectionElement
and then setting its align
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--tableSectionObj.align = "char";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableSectionObj.align
The align
property of the HTMLTableSectionElement
object is the horizontal alignment of data in cells.
Listing 11.355 illustrates the creation of an HTMLTableSectionElement
object and then setting its align
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
tableSectionObj.align = "char";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableSection.ch
The ch
property of the HTMLTableSectionElement
object is the alignment character for cells in a column.
Listing 11.356 illustrates the creation of an HTMLTableSectionElement
and then setting its ch
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
tableSectionObj.align = "char";
tableSectionObj.ch = ".";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableSectionObj.chOff
The chOff
property of the HTMLTableSectionElement
object is the offset of alignment character.
Listing 11.357 illustrates the creation of an HTMLTableSectionElement
object and then setting its chOff
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
tableSectionObj.align = "char";
tableSectionObj.chOff = "22";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableSectionObj.deleteRow(index)
The deleteRow()
method of the HTMLTableSectionElement
deletes a row from this section.
Listing 11.358 illustrates the creation of an HTMLTableSectionElement
object and then invoking its deleteRow()
method.
<html>
<script language="JavaScript" type="text/javascript">
<!--
tableSectionObj.deleteRow(1);
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableSectionObj.insertRow(index)
The insertRow()
of the HTMLTableSectionElement
object inserts a row into this section. The new row is inserted immediately before the current index row in this section. If index
is equal to the number of rows in this section, the new row is appended.
Listing 11.359 illustrates the creation of an HTMLTableSectionElement
and then the invocation of its insertRow()
method.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var rowObj = tableSectionObj.insertRow(1);
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableSectionObj.rows
The rows
property of the HTMLTableSectionElement
object is the collection of rows in this table section.
Listing 11.360 illustrates the creation of an HTMLTableSectionElement
and then reading its rows
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var rowsCollection = tableSectionObj.rows;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTableSectionObj.vAlign
The vAlign
property of the HTMLTableSectionElement
object is the vertical alignment of data in cells.
Listing 11.361 illustrates the creation of an HTMLTableSectionElement
and then setting its vAlign
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
tableSectionObj.align = "char";
tableSectionObj.vAlign = "top";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object represents an HTML multi-line text field. HTMLTextAreaElement
inherits all properties and methods from HTMLElement
. Table 11.40 contains a list of properties and methods for this object.
Listing 11.362 illustrates the creation of an HTMLTextAreaElement
using the HTMLFormElement
object.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var textAreaObj = formObj.createElement("textarea");
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTextAreaObj.accessKey
The accessKey
property of the HTMLTextAreaElement
object is a single character access key to give access to the form control.
Listing 11.363 illustrates the creation of an HTMLTextAreaElement
using the HTMLFormElement
object element and then setting its accessKey
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var textAreaObj = formObj.createElement("textarea");
textAreaObj.accessKey = "q";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTextAreaObj.blur()
The blur()
method of the HTMLTextAreaElement
object removes keyboard focus from this element.
Listing 11.364 illustrates the creation of an HTMLTextAreaElement
using the HTMLFormElement
object element and then the invocation of its blur()
method.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var textAreaObj = formObj.createElement("textarea");
textAreaObj.blur();
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTextArea.cols
The cols
property of the HTMLTextAreaElement
object is the width of control (in characters).
Listing 11.365 illustrates the creation of an HTMLTextAreaElement
using the HTMLFormElement
object and then setting its cols
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var textAreaObj = formObj.createElement("textarea");
textAreaObj.cols = 25;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTextAreaObj.defaultValue
The defaultValue
of the HTMLTextAreaElement
object represents the contents of the element. The value of this attribute doesn’t change if the contents of the corresponding form control, in an interactive user agent, changes. Changing this attribute, however, resets the contents of the form control.
Listing 11.366 illustrates the creation of an HTMLTextAreaElement
using the HTMLFormElement
object and then setting its defaultValue
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var textAreaObj = formObj.createElement("textarea");
textAreaObj.defaultValue = "some default text";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTextAreaObj.disabled
The disabled
property of the HTMLTextAreaElement
object is used to disable the textarea instance.
Listing 11.367 illustrates the creation of an HTMLTextAreaElement
using the HTMLFormElement
object and then setting its disabled
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var textAreaObj = formObj.createElement("textarea");
textArea.disabled = false;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTextAreaObj.focus()
The focus()
method of the HTMLTextAreaElement
object gives keyboard focus to this element.
Listing 11.368 illustrates the creation of an HTMLTextAreaElement
using the HTMLFormElement
object and then the invocation of its focus()
method.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var textAreaObj = formObj.createElement("textarea");
textAreaObj.focus();
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTextAreaObj.form
The form
property of the HTMLTextAreaElement
object returns the FORM
element containing this control. Returns Null
if this control isn’t within the context of a form.
Listing 11.369 illustrates the creation of an HTMLTextAreaElement
using the HTMLFormElement
object and then reading its form
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var textAreaObj = formObj.createElement("textarea");
if(textAreaObj.form.name == "emailForm")
processEmailForm(textAreaObj.form);
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTextAreaObj.name
The name
property of the HTMLTextAreaElement
object is the form control or object name when submitted with a form.
Listing 11.370 illustrates the creation of an HTMLTextAreaElement
using the HTMLFormElement
object and then setting its name
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var textAreaObj = formObj.createElement("textarea");
textAreaObj.name = "blurb";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTextAreaObj.readOnly
The readOnly
property of the HTMLTextAreaElement
object indicates whether or not this control is read-only.
Listing 11.371 illustrates the creation of an HTMLTextAreaElement
using the HTMLFormElement
object element and then setting its readOnly
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var textAreaObj = formObj.createElement("textarea");
textAreaObj.value = "Some readonly text";
textAreaObj.readOnly = true;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTextAreaObj.rows
The rows
property of the HTMLTextAreaElement
object is the number of text rows in the text area.
Listing 11.372 illustrates the creation of an HTMLTextAreaElement
using the HTMLFormElement
object and then setting its rows
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var textAreaObj = formObj.createElement("textarea");
textAreaObj.cols = 25;
textAreaObj.rows = 10;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTextAreaObj.select()
The select()
method of the HTMLTextAreaElement
object selects the contents of the TEXTAREA
.
Listing 11.373 illustrates the creation of an HTMLTextAreaElement
using the HTMLFormElement
object and then the invocation of its select()
method.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var textAreaObj = formObj.createElement("textarea");
textAreaObj.value = "some text";
textAreaObj.select();
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTextAreaObj.tabIndex
The tabIndex
property of the HTMLTextAreaElement
object is the index that represents the element’s position in the tabbing order.
Listing 11.374 illustrates the creation of an HTMLTextAreaElement
using the HTMLFormElement
object and then setting its tabIndex
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var textAreaObj = formObj.createElement("textarea");
textAreaObj.tabIndex = 3;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTextAreaObj.type
The type
property of the HTMLTextAreaElement
object is the type of this form control. This is the string "textarea"
.
Listing 11.375 illustrates the creation of an HTMLTextAreaElement
using the HTMLFormElement
object and then reading its type
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var textAreaObj = formObj.createElement("textarea");
display(textAreaObj.type);
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTextAreaObj.value
The value
property of the HTMLTextAreaElement
object represents the current contents of the corresponding form control, in an interactive user agent. Changing this attribute changes the contents of the form control, but doesn’t change the contents of the element. If the entirety of the data cannot fit into a single string, the implementation might truncate the data.
Listing 11.376 illustrates the creation of an HTMLTextAreaElement
using the HTMLFormElement
object and then setting its value
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var textAreaObj = formObj.createElement("textarea");
textAreaObj.value = "Some random text";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object represents the document title. HTMLTitleElement
inherits all properties and methods from HTMLElement
. The property for this object is as follows:
Listing 11.377 illustrates the creation of an HTMLTitleElement
using the HTMLHeadElement
object element.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var headElement = htmlDoc.createElement("head");
var titleElement = htmlDoc.createElement("title");
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlTitleObj.text
The title
property of the HTMLTitleElement
object represents the specified title of an HTML document.
Listing 11.378 illustrates the creation of an HTMlTitleElement
using the HTMLHeadElement
object element and then setting its text
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var htmlDoc = HTMLDOMImplementation.createHTMLDocument("My HTML Doc");
htmlDoc.open();
var headElement = htmlDoc.createElement("head");
var titleElement = htmlDoc.createElement("title");
titleElement.text = "My New HTML Doc Title";
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
Core DOM HTML object.
This object represents an HTML unordered list element. HTMLUListElement
inherits all properties and method of HTMLElement
. Table 11.41 contains a list of properties for this object.
Listing 11.379 illustrates the creation of an HTMLUListElement
using the HTMLBodyElement
.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var ulObj = bodyObj.CreateElement("ul");
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlUListObj.compact
The compact
property of the HTMLUListElement
object reduces spacing between list items.
Listing 11.380 illustrates the creation of an HTMLUListElement
using the HTMLBodyElement
object and then setting its compact
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var ulObj = bodyObj.CreateElment("ul");
ulObj.compact = true;
// -->
</script>
</html>
JavaScript 1.5+, JScript 5+
Nav6+, IE5+
htmlUListObj.type
The type
property of the HTMLUListElement
object is the bullet style of the element.
Listing 11.381 illustrates the creation of an HTMLUListElement
using the HTMLBodyElement
object and then setting its type
property.
<html>
<script language="JavaScript" type="text/javascript">
<!--
var ulObj = bodyObj.CreateElement("ul");
ulObj.type = "bullet";
// -->
</script>
</html>
3.145.84.112