This example requires a version 4.0 or higher browser.
x = ((myObject1.style.posLeft >= myObject2.style.posLeft) &&
(myObject.style.posLeft <= myObject2.style.posLeft));
y = ((myObject.style.posTop >= myObject2.style.posTop) &&
(myObject1.style.posTop <= myObject2.style.posTop));
if (x && y)
// Collision has occurred.