I have read a couple of threads regarding javascript arrays & php but still couldnt find a solution to my problem.

Here is a sample code of what Im trying to do

PHP Code:
<script language="javascript">
chkcat() {

alert(document.frm1.elements['dog[]'].length); // This alert works fine because it has 2 elements in the form

alert(document.frm1.elements['cat[]'].length); // This alert displays "undefinded" because there is only 1 array element in the form

for (0document.frm1.elements['dog[]'].lengthi++) 
<form name="frm1">
<input type="input" name="cat[]" value="meow">
<input type="input" name="dog[]" value="bow">
<input type="input" name="dog[]" value="wow">
<input type="input" name="rabbit[]" value="">
<input type="input" name="rabbit[]" value="">

<input type="button" value="Press" onclick="chkcat()">
When I try to read the value of "cat[]" array element it displays "undefined" but for other array elements it works fine.

How can I get the value of an array with 1 element.

Thanks for your help