It is well-documented that if on a page there are several radio-
buttons with the same name these are addressed as an array (and act
collectively).
Someone (LRN?) recently wrote about another case where name-match
implies array addressing.
It therefore occurred to me to try the following crude Web page :
<head></head><body>
<form name=F1>
<input type=text name=A size=3 value=00>
<input type=text name=A size=3 value=11>
<input type=text name=A size=3 value=22>
<input type=button name=B onClick=X() value=" ?? ">
</form>
<script>
J=0
function X() {
F1.B.value = " " + F1.A[J++%3].value + " "
}
</script>
</body>
On it, in my MSIE4, pressing the ?? button repeatedly cycles its
legend through 00 11 22 00 11 22 00 ... which demonstrates that such
a set of name-matched controls can be accessed as an array there.
Is that legitimate and generally available? I do not recall reading
it.
In particular, where I have a table similar in principle to
2001 2002 2003 2004 2005
St P Sat Sun Mon Wed Thu
St G Mon Tue Wed Fri Sat
St A Fri Sat Sun Tue Wed
and wish to auto-change the columns to be Year-2..Year+2 for any
(current) Year, can I use for the St P row five instances of
<input type=text name=StP size=5 readonly> and compute in turn
elements [0]..[4] of this array (likewise for other rows), and have
it working successfully for all reasonable javascript-enabled
browsers?
Could I use <div>..</div> with DynWrite thus, instead of <input
....>?
I postpone the possibility of having a dynamic column-count such
that there is at least one instance of each of the days of the week
in both the row for Feb 28 and that for Mar 1.
--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.
Comment