W3C DOM tests - attribute name and value

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 the attributes[] array.

Other attribute tests:

Test scripts

name and value

alert('name is ' + x.attributes[1].name)
alert('value is ' + x.attributes[1].value)
alert(x.attributes[4].name)
alert(x.attributes[4].value)
alert(x.attributes['align'].value)
alert(x.getAttributeNode('align').value)
alert(x.attributes['onclick'].value)
alert(x.getAttributeNode('onclick').value)
alert(x.attributes['style'].value)
alert(x.getAttributeNode('style').value)
alert(x.attributes['ppk'].value)
alert(x.getAttributeNode('ppk').value)