Tweet
SIGN UP
MEMBER LOGIN:
TECHNOLOGIES
.NET 4.5
.NET Remoting in C#
Active Directory C#
ADO.NET in C#
AJAX in C#
Algorithms in C#
Android Programming
Articles C#
ASP, JavaScript, CSS
ASP.NET Controls in C#
ASP.NET MVC with C#
ASP.NET Programming
BizTalk Server
C# Assemblies
C# Language
C# Tutorials
C, C++, MFC
Career Advice
Chapters
Cloud Computing
COBOL.NET
Coding Best Practices
COM Interop
Compact Framework
Cryptography C#
Crystal Reports C#
Current Affairs
Custom Controls C#
Databases & DBA
Deployment
Design & Architecture
DirectX C#
Enterprise Development
Error Zone
Exception Handling C#
Expression Studio
F#
Files, Directories in C#
Financial Applications
Games Programming C#
GDI+ & Graphics
Hardware
How do I
HTML 5
Internet & Web
iPhone/iPad
Java
Java and .NET
JQuery
JSP
Leadership
Learn .NET
LINQ with C#
Metro Style Apps in C#
Mobile & Embedded
MonoDevelop
MSMQ in C#
Multithreading in C#
Networking
Office Development
OOP/OOD
Operating Systems
PHP
Printing in C#
Products
Project Management
Reports using C#
Robotics & Hardware
Security in .NET
SharePoint
Silverlight with C#
Smart Devices
Speech in C#
SQL
SQL Server 2012
String in C#
Team Foundation & VSS
Testing
Visual Basic .NET
Visual C#
Visual Studio .NET
Visual Studio 11
Visual Studio 2010
VS LightSwitch 2011
WCF with C#
Web Forms C#
Web Services in C#
WebForms Controls
Windows 8 in C#
Windows Controls C#
Windows Forms C#
Windows Phone in C#
Windows PowerShell
Windows Services in C#
Workflow Foundation in C#
WPF with C#
XAML with C#
XML in C#
XNA with C#
FORUMS
BLOGS
VIDEOS
INTERVIEWS
CERTIFICATIONS
DOWNLOADS
BOOKS
LINKS
NEWS
Learn .NET in 60 days – Part 1 (13 Labs)
Learn MVC (Model view controller) Step by Step ...
Learn C# Corner - Home
Using Border Radius and Gradients in CSS3: Part I
Learn C# Corner - Footer
Learn .NET and C# in 60 Days Lab13(Day 5): - C ...
iPhone 5 First Look
Samsung Galaxy Note Review
WCF - Authentication and Authorization in Ente ...
How to write a good article on C# Corner
Blog
Count the maximum length of textbox using Javascript
Posted by
Purushottam Rathore
in
Blogs
|
ASP, JavaScript, CSS
on
Jun 28, 2011
Count the maximum length of textbox using Javascript
Tweet
1506
0
0
<%
@
Page
Language
="C#"
AutoEventWireup
="true"
CodeFile
="MexLength.aspx.cs"
Inherits
="MexLength"
%>
<!
DOCTYPE
html
PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
="http://www.w3.org/1999/xhtml">
<
head
runat
="server">
<
title
>
Maximum length counter
</
title
>
<
script
language
="JavaScript">
function
textCounter(field, countfield, maxlimit) {
if
(field.value.length > maxlimit)
// if too long...trim it!
field.value = field.value.substring(0, maxlimit);
else
countfield.value = maxlimit - field.value.length;
}
</
script
>
</
head
>
<
body
>
<
form
id
="Form1"
name
="myform"
runat
="server">
<
asp
:
TextBox
ID
="TextBoxMessage"
runat
="server"
TextMode
="MultiLine"
Height
="60px"
onkeydown
="
textCounter(TextBoxMessage,LengthCount,25)
"
onkeyup
="
textCounter(TextBoxMessage,LengthCount,25)
"
></
asp
:
TextBox
>
<
input
readonly
type
="text"
name
="LengthCount"
size
="3"
maxlength
="3"
value
="25">
</
form
>
</
body
>
</
html
>
share this blog :
7 Great JavaScript Resources
HTML Codes
Related Blogs
Count the characters while entering in TextBox using Javascript
Javascrip-Add new textbox at runtime in your DIV tag
How To Invoke Function At Server Side?
ZoomIn & ZoomOut of image on mouse over event
Insert data using JavaScript and Web Service
Javascript-Split the whole string into substring.
post comment
Sponsored by
Become a Sponsor
More Blogs from this Blogger
Email Validation in wpf
Most popular video formats
Benefits and limitations of using Cookies
Sending any value from one form to another form in WPF
Count the maximum length of textbox using Javascript
Difference between Sql server 2005 and 2008
Keep in mind while using Ajax Updatepanel.
PopUp window using JavaScript in asp.net
Serial number in Gridview or datalist in asp.net
What is Index in sql server? It's purpose?
View All
Latest Blogs
Free Ride is Over for Desktop Developers in Visual Studio 11
DotNet developers most used application/tools launching through 'Run'
80-inch Windows 8 Tablet
Data encapsulation
Option to access the Column Names in Data table
Open multiple windows in browser startup. (Multiple homepages option)
I'm Sorry
const and readonly
Address, Binding and Contract in WCF
JQuery Maxchars Plugin
View All
Sponsored by
Become a Sponsor