Monday, March 2, 2009

Restricting Text box (Multiline) using Javascript

//Restrict Length
function restrictLength(e,ctl,maxLength)
{
var evt = e ? e : window.event;

//check the length for copy paste
if (ctl.value.length >= maxLength)
{
//only character
if (e.keyCode == 0)
{
return false;
}
}
return true;
}
-- don't for get to called using (RETURN)
javascript:return restrictLength(event,this,10);

No comments: