Jump to content

javascript array problem


MDanz

Recommended Posts

the following code doesn't work.  If i change 'textarea[]' to just 'textarea' it works.  But i need textarea in an array.

 

<SCRIPT LANGUAGE="JavaScript">

function counter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) 
field.value = field.value.substring(0, maxlimit);
else
cntfield.value = maxlimit - field.value.length;
}
</script>

<form name="submitform">

<textarea name="textarea[]"  cols="30" rows="1"
onKeyDown="counter(document.submitform.textarea[],document.submitform.charleft,1000)"
onKeyUp="counter(document.submitform.textarea[],document.submitform.charleft,1000)"></textarea>
<br>
<input readonly type="text" name="charleft" size="3" maxlength="4" value="1000">
characters left

</form>

Link to comment
https://forums.phpfreaks.com/topic/237340-javascript-array-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.