I only manage to access non array named form fields.

<form method="post">
<input type=checkbox name=check[]>
<input type=text name=justinput value=testing>
<input type=checkbox name=check[]>
<input type=text name=input[] value=foo>
<input type=checkbox name=check[] onclick="getthis(form, this)">
<input type=text name=input[] value=bar>

function getthis(form, test) {
form.justinput.value="foobar" // works
document.getElementById('justinput').value="foobar" // works
//form.input[0].value="foobar" // fails
//document.getElementById('input[0]').value="foobar" // fails
Is there a way to at least get the index out of the clicked checkbox, and thus being able to access its matching input[]?