or better yet: <p id="caption-reveal" onmouseover="classChange(this, 'visible')" onmouseout="classChange(this, 'hidden')"> *this* is the element you want to change class on, so you don't even need to look it up in document.getElementById().. and you can change your id at will without also having to update the handler arguments. Sam