Erickk 0 Newbie Poster
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

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

</script>

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

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.