Use standard methods for attribute change.

This avoids browser bugs, and is not stupid.