Home
Form Effects
Textarea Maxlength script
Developer's View
<html>
<head>
<script type="text/javascript">
/***********************************************
* Textarea Maxlength script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)
}
</script>
</head>
<body>
<form>
<textarea maxlength="4" rows="5" cols="35"
onkeyup="ismaxlength(this)"></textarea>
</form>
</body>
</html>