document.getElementById("<%=txtDateTo.ClientID%>").value=="")
Are you using jsp scriplet in javascript? jsp scriplet only works in jsp. Pass this id as parameter in Sdatecheck(var id) from jsp page ,then it will work. like :
onclick="Sdatecheck('<%=txtDateTo.ClientID%>')"