Copy codeThe Code is as follows:
<Script language = "javascript" type = "text/javascript">
Function countNum ()
{
Var count = document. getElementById ("txtText"). value. length;
Document. getElementById ("lblCount"). value = count;
}
</Script>
Copy codeThe Code is as follows:
<Asp: TextBox ID = "txtText" name = "txtText" runat = "server" Columns = "80" Rows = "8" TextMode = "MultiLine"
Width = "pixel PX" Height = "150px" onkeydown = "countNum ();"
Onmousemove = "countNum ();" onmouseout = "countNum ();" onkeyup = "countNum ();"> </asp: TextBox>
(The word <input id = "lblCount" type = "button" style = "border-style: none; background: none;" value = "0"/> has been entered)
| Mouse and keyboard events |
| Event |
Description |
| OnClick |
Click an event. |
| OnDblClick |
Double-click event |
| OnMouseDown |
The button on the mouse is pressed. |
| OnMouseUp |
Events triggered when the mouse is pressed and released |
| OnMouseOver |
Event triggered when you move the cursor over an object range |
| OnMouseMove |
Events triggered when you move the mouse |
| OnMouseOut |
Event triggered when the mouse leaves the range of an object |
| OnKeyPress |
Event triggered when a key on the keyboard is pressed and released. [Note: The page must contain focused objects] |
| OnKeyDown |
Events triggered when a key is pressed on the keyboard [NOTE: The page must contain focused objects] |
| OnKeyUp |
Events triggered when a button on the keyboard is pressed and opened [NOTE: The page must contain focused objects] |