<?php function textrem( field, maxlimit ) { var field2 = document.getElementById(field); if ( field2.value.length > maxlimit ) { field2.value = field2.value.substring( 0, maxlimit ); return false; } } ?>