Hi,
i am doing a text box counter which automatically count the total character in the text box as user typing and show it in a label.So for any key user typing including "delete" and "backspace"key , the total character will be shown in the label automatically.
My coding is as below :
My javascript is as belowCode:txtMsg.Attributes.Add("OnKeyPress", "return txtCount(event,'txtMsg')")
However, i am not able to deliver the total count result to label2 and also when user click "delete" or "backspace" button, my javascript did not working and count the total character.Does anyone has any idea on this?Code:function txtCount(e, txtid) { var evt = e ? e : window.event; var txt = document.getElementById(txtid); var x; x=document.getElementById("txtMsg").value.length; document.getElementById("Label2").value=x; }




Reply With Quote