This is the first test element.
It has the following attributes, in this order:
id="test"
align="center"
style="border: 1px solid #3B5F9B"
onclick="alert('Clicked!')"
ppk="JavaScript"
This is the second test element. It has only one attribute:
id="test2"
This page contains test cases for miscellaneous attribute functionality.
Other attribute tests:
x
has all these attributes except for class
.
alert(x.hasAttribute('align'))
alert(x.hasAttribute('class'))
alert(x.hasAttribute('ppk'))
alert(x.hasAttribute('onclick'))
alert(x.hasAttribute('style'))
alert(x.hasAttributes())
z
is the <p>
just below this test. It doesn't have attributes.
alert(z.hasAttributes())
Test paragraph without attributes.
alert(x.attributes['onmouseover'].specified)
alert(x.attributes[1].specified)
x.clearAttributes()
y.mergeAttributes(x)