<html>
<link rel="stylesheet" href="josh.css">
<body bgcolor="#FFFFFF">

		<div id="Description">
			<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
				<tr><td valign="top" class="name">Attr, attribute</td><td valign="top" nowrap class="compatibility">NN <span class="emphasis">6</span>  IE <span class="emphasis">5</span>  DOM <span class="emphasis">1</span>&nbsp;&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" nowrap class="usage"><p class="literal"></p>
					</td><td valign="top" nowrap class="requirements">&nbsp;&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="description">
						<p>An abstract representation of an element's attribute
name/value pair is an object known in the W3C DOM vernacular as the
<span class="literal">Attr</span> object; in IE terminology, it is called an
<span class="literal">attribute</span> object. They are different names for the
same object. An attribute object is created in both environments via
the <span class="literal">document.createAttribute()</span> method; the
reference to the attribute object then becomes the parameter to an
element's <span class="literal">setAttributeNode()</span>
method to insert that attribute object into the element. For example:
</p>
<span class="PROGRAMLISTING"><pre>var newAttr = document.createAttribute(&quot;author&quot;);
newAttr.value = &quot;William Shakespeare&quot;;
document.getElementById(&quot;hamlet&quot;).setAttributeNode(newAttr);</pre></span>
							</td>
						</tr>
    <tr>
      <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
    </tr>
						<tr>
							<td colspan="2"><p>			Some W3C DOM element methods (most notably, the
<span class="literal">getAttributeNode()</span> method) return attribute
objects, which have properties that may be accessed like any
scriptable object.
</p>
							</td>
						</tr>
    <tr>
      <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
    </tr>
						<tr>
							<td colspan="2"><p>	In the W3C DOM abstract model, the <span class="literal">Attr</span> object
inherits all properties and methods of the <span class="literal">Node</span>
object. Some <span class="literal">Node</span> object properties, however, are
not inherited by the <span class="literal">attribute</span> object in
IE/Windows until Version 6, even though they are implemented for
element and text nodes in Version 5.
</p>
												</td>
</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="htmlequivalent"><span class="title">HTML Equivalent</span></td>
				</tr>
				<tr>
					<td colspan="2"><p>			Any name/value pair inside a start tag.</p>
					</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="objectmodelreference"><span class="title">Object Model Reference</span></td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td><span class="programlisting"><pre>[window.]document.getElementById("<span class="replaceable">elementID</span>").attributes[<span class="replaceable">i</span>]
[window.]document.getElementById("<span class="replaceable">elementID</span>").attributes.item(<span class="replaceable">i</span>)
[window.]document.getElementById("<span class="replaceable">elementID</span>").attributes.getNamedItem[<span class="replaceable">attrName</span>]</pre>
						</span></td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="objectspecificproperties"><span class="title">Object-Specific Properties</span></td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td>
						<table border="1"><tbody><tr><td><span class="literal">expando</span></td><td><span class="literal">name</span></td><td><span class="literal">ownerElement</span></td><td><span class="literal">specified</span></td><td><span class="literal">value</span></td>
								</tr>
							</tbody></table>
					</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="objectspecificmethods"><span class="title">Object-Specific Methods</span></td>
				</tr>
				<tr>
					<td colspan="2"><p>			None.</p>
					</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="objectspecificeventhandlerproperties"><span class="title">Object-Specific Event Handler Properties</span></td>
				</tr>
				<tr>
					<td colspan="2"><p>			None.</p>
					</td>
				</tr>
			</table>
		</div><div id="expando">
			<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
				<tr><td valign="top" class="name">expando</td><td valign="top" nowrap class="compatibility">NN <span class="emphasis">n/a</span> IE <span class="emphasis">6</span>  DOM <span class="emphasis">n/a</span>&nbsp;&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" nowrap class="usage"><p class="literal"></p>
					</td><td valign="top" nowrap class="requirements">Read-only&nbsp;&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="description">
						<p>Returns Boolean <span class="literal">true</span> if the attribute, once it is
inserted into an element, is not one of the native attributes for the
element. This property is <span class="literal">false</span> for an attribute
created by <span class="literal">document.createAttribute()</span> until the
attribute is added to the element (via the <span class="literal">setAttributeNode(
)</span> method), at which time the property's
value is reevaluated within the context of the
element's native attributes.
</p>
												</td>
</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td><span class="programlisting"><pre>var isCustomAttr =
  document.getElementById("book3928").getAttributeNode("author").expando;</pre>
						</span></td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="value"><span class="title">Value</span></td>
				</tr>
				<tr>
					<td colspan="2"><p>			Boolean value: <span class="literal">true</span> | <span class="literal">false</span>.</p>
					</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" nowrap colspan="2" class="default"><span class="title">Default</span></td>
				</tr>
				<tr>
					<td colspan="2"><p>			<span class="literal">false</span></p>
					</td>
				</tr>
			</table>
		</div><div id="name">
			<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
				<tr><td valign="top" class="name">name</td><td valign="top" nowrap class="compatibility">NN <span class="emphasis">6</span> IE <span class="emphasis">5</span>  DOM <span class="emphasis">1</span>&nbsp;&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" nowrap class="usage"><p class="literal"></p>
					</td><td valign="top" nowrap class="requirements">Read-only&nbsp;&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="description">
						<p>This is the name portion of the name/value pair of the attribute. It
is identical to the <span class="literal">nodeName</span> property of the
<span class="literal">Attr</span> node. You may not modify the name of an
attribute by script because other dependencies may lead to document
tree confusion. Instead, replace the old attribute with a newly
created one, the name of which is a required parameter of the
<span class="literal">document.createAttribute()</span> method.
</p>
												</td>
</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td><span class="programlisting"><pre>if (myAttr.name == "author") {
    // process author attribute
}</pre>
						</span></td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="value"><span class="title">Value</span></td>
				</tr>
				<tr>
					<td colspan="2"><p>			String value.</p>
					</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" nowrap colspan="2" class="default"><span class="title">Default</span></td>
				</tr>
				<tr>
					<td colspan="2"><p>			Empty string, although creating a new attribute requires a name.</p>
					</td>
				</tr>
			</table>
		</div><div id="ownerElement">
			<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
				<tr><td valign="top" class="name">ownerElement</td><td valign="top" nowrap class="compatibility">NN <span class="emphasis">6</span> IE <span class="emphasis">n/a</span>  DOM <span class="emphasis">2</span>&nbsp;&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" nowrap class="usage"><p class="literal"></p>
					</td><td valign="top" nowrap class="requirements">Read-only&nbsp;&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="description">
						<p>Refers to the element that contains the current attribute object.
Until a newly created attribute is inserted into an element, this
property is <span class="literal">null</span>.
</p>
												</td>
</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td><span class="programlisting"><pre>if (myAttr.ownerElement.tagName == "fred") {
    // process attribute of &lt;fred&gt; element
}</pre>
						</span></td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="value"><span class="title">Value</span></td>
				</tr>
				<tr>
					<td colspan="2"><p>			Element node reference.</p>
					</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" nowrap colspan="2" class="default"><span class="title">Default</span></td>
				</tr>
				<tr>
					<td colspan="2"><p>			<span class="literal">null</span></p>
					</td>
				</tr>
			</table>
		</div><div id="specified">
			<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
				<tr><td valign="top" class="name">specified</td><td valign="top" nowrap class="compatibility">NN <span class="emphasis">6</span> IE <span class="emphasis">5</span>  DOM <span class="emphasis">1</span>&nbsp;&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" nowrap class="usage"><p class="literal"></p>
					</td><td valign="top" nowrap class="requirements">Read-only&nbsp;&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="description">
						<p>Returns Boolean <span class="literal">true</span> if the value of the attribute
is explicitly assigned in the source code or adjusted by script. If
the browser reflects an attribute that is not explicitly set (IE does
this), the <span class="literal">specified</span> property for that value is
<span class="literal">false</span>, even though the attribute may have a
default value determined by the document's DTD. The
W3C DOM Level 2 indicates that the <span class="literal">specified</span>
property of a freshly created <span class="literal">Attr</span> object should
be <span class="literal">true</span>, but both IE 6 and Netscape 6.2 and later
leave it <span class="literal">false</span> until the attribute is inserted
into an element.
</p>
												</td>
</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td><span class="programlisting"><pre>if (myAttr.specified) {
    // process attribute whose value is something other than DTD default
}</pre>
						</span></td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="value"><span class="title">Value</span></td>
				</tr>
				<tr>
					<td colspan="2"><p>			Boolean value: <span class="literal">true</span> | <span class="literal">false</span>.</p>
					</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" nowrap colspan="2" class="default"><span class="title">Default</span></td>
				</tr>
				<tr>
					<td colspan="2"><p>			<span class="literal">false</span></p>
					</td>
				</tr>
			</table>
		</div><div id="value">
			<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
				<tr><td valign="top" class="name">value</td><td valign="top" nowrap class="compatibility">NN <span class="emphasis">6</span> IE <span class="emphasis">6</span>  DOM <span class="emphasis">1</span>&nbsp;&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" nowrap class="usage"><p class="literal"></p>
					</td><td valign="top" nowrap class="requirements">Read/Write&nbsp;&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="description">
						<p>Provides the value portion of the name/value pair of the attribute.
Identical to the <span class="literal">nodeValue</span> property of the
<span class="literal">Attr</span> node, as well as data accessed more directly
via an element's <span class="literal">getAttribute()</span>
and <span class="literal">setAttribute()</span> methods. If you create a new
attribute object, you can assign its value via the
<span class="literal">value</span> property prior to inserting the attribute
into the element. Attribute node values are always strings, including
in IE, which otherwise allows Number or Boolean data types for the
corresponding properties.
</p>
												</td>
</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="example"><span class="title">Example</span></td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td><span class="programlisting"><pre>document.getElementById("hamlet").getAttributeNode("author").value = "Shakespeare";</pre>
						</span></td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="value"><span class="title">Value</span></td>
				</tr>
				<tr>
					<td colspan="2"><p>			String value.</p>
					</td>
				</tr>
				<tr>
					<td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
				</tr>
				<tr>
					<td valign="top" nowrap colspan="2" class="default"><span class="title">Default</span></td>
				</tr>
				<tr>
					<td colspan="2"><p>			Empty string, except in IE/Windows, which returns the string
<span class="literal">undefined</span> (that is, not a value whose type
evaluates to the <span class="literal">undefined</span> value).
</p>
					</td>
				</tr>
			</table>
		</div>

</body>
</html>