Forse cosi ( non so se esiste un metodo + semplice )
codice:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> <script language="JavaScript" type="text/javascript"> <!-- function conta() { c = 0; oColl = document.getElementsByTagName('INPUT'); for (i=0;i<oColl.length;i++) { curInp = oColl.item(i); if (curInp.type == 'text' && curInp.name.match(/^Campo[[]\d+[]]$/)) { c++; } } return c; } //--> </script> </head> <body> <form name="nomeMiaform"> <input type="text" name="Campo[0]"> <input type="text" name="Campo[1]"> <input type="text" name="Campo[2]"> <input type="text" name="Campo[122]"> <input type="text" name="Campo_[122]"> </form> <script language="JavaScript" type="text/javascript"> <!-- alert(conta()) //--> </script> </body> </html>


Rispondi quotando