Hi Mauli,
You could try this code
<!DOCTYPE html>
<html>
<body>
<script language="javascript" type="text/javascript">
</script>
<input type="text" id="txtbx"/>
<input type="button" onclick="validate();" value="Click me"/>
</body>
</html>
Hope this helps you a bit.
Regards,
RK