<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<script language="javascript" type="text/javascript">
function run(){
if (document.txtbox.value.length==0){


<form name="test" action="javascript:void()"  method="get">
<input type ="text" name="txtbox" value="" />
<input type ="button" name="btn" value="CLICK" onclick="run()" />

I'm using masterpage and the above code is on dafault.aspx, I wanted to place some JS on aspx page. However i encounter error state that

Message: 'document.txtbox.value' is null or not an object

Why is tat so?