setAttribute Example

Click on a table cell to set a new attribute value in that cell. The new value will display in the space below the table.

The table demonstrates these attributes:

Case Sensitivity

Property Names

Event Handlers

Cell 1:
attribute = "bgColor"
value = "green"
Cell 2:
attribute="bgcolor"
value = "green"
Cell 3:
attribute = "className"
value = "myClass"
Cell 4:
attribute = "class"
value="myClass"
Cell 5:
attachEvent = "onmouseout"
value = "doEvent" (this is a user-defined function)
Cell 6:
attribute = "onmouseout"
value = "this.bgColor='green'"
Click a table cell above to view its modified attributes here.



[Right-click and choose View Source from the shortcut menu.]

© 2007 Microsoft Corporation. All rights reserved. Terms of use.