Geoff Cox <gc**@freeuk.notcomwrites:
I can refer to a form element called value using
f.B1.value (where B1 is the name of the input)
Maybe you can, maybe you can't, but in any case, you shouldn't.
Use the stanard form:
document.forms['f'].elements['B1'].value
but need to put this into the more general form to cover
f.B2.value, f.B3.value etc
I wrote
var name='B'+test_num;alert(f.name.value);
and this doesn't work.
As it shouldn't. You are loking up a property called "name",
and never referencing the "name" variable.
>
Also tried
var name='B'+test_num;alert('f.' + name + '.value');
Here you do string manipulation, and the result is a string.
but this just gives 'f.' + name + '.value' and not the actual value.
It gives the value of the string.
How do I do this?!
var name = 'B' + test_num;
var value = document.forms['f'].elements[name].value;
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'