/* Variables globales */
var maxTextareaLength = 255;
/* Fin Variables */
function addEvent(o,e,f){
if (o.addEventListener){ o.addEventListener(e,f,true); return true; }
else if (o.attachEvent){ return o.attachEvent("on"+e,f); }
else { return false; }
}
function textAreaStopper() {
var areas = document.getElementsByTagName('TEXTAREA');
for(var i=0; i<areas.length; i++)
if(areas[i].className=="limited" )
{
area = areas[i];
area.onkeydown = function () {
if(this.value.length>maxTextareaLength)
this.value = this.value.substr(0, maxTextareaLength);
}
}
}
addEvent(window, "load", textAreaStopper); |