Ho questo codice di prova:
codice:
<Html>
<Head>
<Title>
Testing..
</Title>
<Script Language=Javascript>
function test(Obj)
{
var theObj;
for(i=0;i<document.getElementById(Obj).children.length;i++)
{
theObj = document.getElementById(Obj).children(i);
alert('Ctrl ' + i + ' = ' + theObj.id + ' - ' + theObj.tagName + ' - ' + theObj.type);
if(document.getElementById(theObj).children.length>0)
test(theObj.id);
}
}
</Script>
</Head>
<Body>
<Form Name=MainForm Action=# Type=POST>
<div id=d1>
<Input Type=text id=a>
</div>
<div id=d2>
<Input Type=text id=b>
</div>
<div id=d3>
<Input Type=text id=c>
</div>
<div id=d4>
<Input Type=button Id=Submit Value=Send onClick="Javascript:test('MainForm');">
</div>
</Form>
</Body>
</Html>
provate ad eseguirlo... cosa c'è che non va secondo voi?
E' una funzione ricorsiva che esplora tutti fli elementi di un form