<html> <body> <script language="JavaScript"> function function1(){ var myRange1 = document.body.createTextRange(); var myRange2 = myRange1.duplicate(); alert(myRange1.isEqual(myRange2)); } </script> <p>This is some sample range used in comparison</p> <button onclick="function1();">IsEqual</button> </body> </html>