T
teser3
I have the below that limits the textarea input to 500 characters but
cant get the alert message to work. It doesnt show anything. Please
advise.
<script language="javascript" type="text/javascript">
function limitText(limitField, limitCount, limitNum) {
if (limitField.value.length > limitNum) {
limitField.value = limitField.value.substring(0, limitNum);
alert("You are trying to enter more
than 500 characters");
} else {
limitCount.value = limitNum - limitField.value.length;
}
}
</script>
--------------------------------------------------------------------------------
<form name="myform">
<textarea name="limitedtextarea"
onKeyDown="limitText(this.form.limitedtextarea,this.form.countdown,
500);"
onKeyUp="limitText(this.form.limitedtextarea,this.form.countdown,
500);">
</textarea>
cant get the alert message to work. It doesnt show anything. Please
advise.
<script language="javascript" type="text/javascript">
function limitText(limitField, limitCount, limitNum) {
if (limitField.value.length > limitNum) {
limitField.value = limitField.value.substring(0, limitNum);
alert("You are trying to enter more
than 500 characters");
} else {
limitCount.value = limitNum - limitField.value.length;
}
}
</script>
--------------------------------------------------------------------------------
<form name="myform">
<textarea name="limitedtextarea"
onKeyDown="limitText(this.form.limitedtextarea,this.form.countdown,
500);"
onKeyUp="limitText(this.form.limitedtextarea,this.form.countdown,
500);">
</textarea>