<html>
<body>
<input type=button id=btnDemo>
</body>
<script language="javascript">
var chk1 = document.all.btnDemo;
var chk2 = document.all.btnNoExist;
alert("btnDemo: " + chk1 + "\nbtnNoExist: " + chk2)
if (chk2 != "[object]")
alert("The object doesn't exist");
else
alert("Found object");
</script>
</html>