Find textbox length in javascript

In this tutorial,I will explain how to find the length of textbox using javascript.It is very easy to find textbox length in javascript.we can use javascript length property.

Example:Find textbox length in javascript
<title>Textbox limit characters</title>
function findTextboxLength()
textbox_val=textbox1.value;//gets the value of the input element entered by the user.
    textbox_length = textbox_val.length;//find the length of textbox in javascript
    if (textbox_length < 10)
        char = 10 - textbox_length;
        msg = char + " characters left";
        text_span.innerHTML="<font color=blue>" + msg + "</font>";
        text_span.innerHTML="<font color=red>Message is too long</font>";
<INPUT type="text" id="textbox1" onKeyUp="findTextboxLength();" >
<span id="text_span" name="text_span"></span>