function proverka() { var x = document.getElementsByTagName('img')[0]; var y = document.getElementsByTagName('img')[1]; if ( getOffsetRect(x) == getOffsetRect(y)) { alert("you are right") }; }