Getting of attributes in JavaScript

Given an element:

<input id="elem" value="text">

Get the value of its value attribute.

Given an element:

<input id="elem" class="www zzz">

Get the value of its class attribute.

enru