When programming, you sometimes use custom properties of web server controls. For example, there is no IsNotNull property in the TextBox control, but we can add an IsNotNull property ourselves to use it as a mark to facilitate our programming.
Although the IDE will prompt a warning message "IsNotNull is not a property of TextBox", it does not prevent us from using it!
Code:
<asp:TextBox ID="TextBox1" runat="server" IsNotNull="e"></asp:TextBox>
Write Javascript code:
Copy the code code as follows:
<script language=javascript type="text/javascript">
function getClick()
{
var c=document.getElementById("<%=TextBox1.ClientID %>");
if(c.IsNotNull == 1)
{
alert("IsNotNull is 1");
}
else if(c.IsNotNull == 0)
{
alert("IsNotNull is 0");
}
else
{
alert(c.IsNotNull); //If it is not 0 or 1, the attribute value of IsNotNull will be displayed.
}
}
</script>