dass du die Radio-Buttons mit deiner Schleife mit onClick-EventHandler versorgen willst
gruß
peter
<input type="radio" name="bla_1" value="A1" />
<input type="radio" name="bla_1" value="B2" />
<input type="radio" name="bla_1" value="C3" />
<input type="radio" name="blubb_1" value="A1" />
<input type="radio" name="blubb_1" value="B2" />
<input type="radio" name="blubb_1" value="C3" />
<input type="radio" name="blubber_1" value="A1" />
<input type="radio" name="blubber_1" value="B2" />
<input type="radio" name="blubber_1" value="C3" />
<input type="radio" name="bla_1" value="B2" />
<input type="radio" name="blubb_1" value="B2" />
<input type="radio" name="blubber_1" value="B2" />
<input type="radio" name="bla_2" value="1" />
<input type="radio" name="bla_2" value="2" />
<input type="radio" name="bla_2" value="3" />
<input type="radio" name="blubb_2" value="4" />
<input type="radio" name="blubb_2" value="5" />
<input type="radio" name="blubb_2" value="6" />
<input type="radio" name="blubber_2" value="7" />
<input type="radio" name="blubber_2" value="8" />
<input type="radio" name="blubber_2" value="9" />
<input type="radio" name="bla_2" value="2" />
<input type="radio" name="blubb_2" value="5" />
<input type="radio" name="blubber_2" value="8" />
var myIndex; // myIndex ist global
var radios = document.getElementsByTagName('input');
for (i = 0; i < radios.length; i++)
{
document.getElementsByTagName('input')[i].onclick = function ()
{
myIndex = i;
alert(document.getElementByName('bla_2')[myIndex].value + ' = ' +
document.getElementByName('blubb_2')[myIndex].value + ' = ' +
document.getElementByName('blubber_2')[myIndex].value);
}
}
myIndex = i;
var myIndex; // global
var i;
var j;
for (i=1; i<=den_max_index_des_Radios_namens; i++)
{
for (j=0; j<document.getElementByName('bla_'+i).length; j++) {
document.getElementByName('bla_'+i)[j].onclick = function()
{
myIndex = j;
alert....;
}
}
for (j=0; j<document.getElementByName('blub_'+i).length; j++) {
document.getElementByName('bla_'+i)[j].onclick = function()
{
myIndex = j;
alert....;
}
}
...
}
for (j=0; j<document.getElementByName('bla_'+i).length; j++)
var radiogroups = {};
var radios = document.getElementsByTagName('input');
var name = '';
for (var i = 0; i < inputs.length; ++i) {
name = inputs[i].name;
if (radiogroups[name] == undefined)
radiogroups[name] = 0;
else
++radiogroups[name];
inputs[i].indexInRadioGroup = radiogroups[name];
inputs[i].onclick = function() { alert(this.indexInRadioGroup); }
}
Kommentar