Re: Help needed dynamically accessing table cell values



In article <1193840287.433100.188260@xxxxxxxxxxxxxxxxxxxxxxxxxxx>, "es330td@xxxxxxxxx" <es330td@xxxxxxxxx> wrote:
[...]
function checkvalue(myvar) {
var ary,i;

ary = document.getElementsByTagName("TD")
for(i in ary)
{
alert(i + ' ' + document.getElementById('td1').innerText);
}
}
</script>

When I run this onBlur it will run through the loop and pop up an
alert box with TD1 1/2/2007 and then one with TD2 3/14/2007. As a
result I know that the ary = assignment is working.

However, if I try to substitute i for the 'td1' in the getElementById
property it tells me Object Required. What is the right way to do
this?

Have you tried getElementById('td' + i) ?


--
Regards,
Doug Miller (alphageek at milmac dot com)

It's time to throw all their damned tea in the harbor again.
.



Relevant Pages

  • Re: Awesome Tutorials for JavaScript beginners
    ... If the statement is false we exit from the while loop. ... Most Web developers think browser scripting is ... var UA = navigator.userAgent.toLowerCase; ... I suppose they could contact the authors of the script ...
    (comp.lang.javascript)
  • Re: slowing a script down
    ... When I add an alert to check it for each step of the loop, ... var stringWidth = new String; ... panelwidth = the character position where the string px is first found? ... can be re-used to animate any panel. ...
    (microsoft.public.scripting.jscript)
  • Re: Illegal LOOP usage?
    ... | reason would they even mention the WITH clause there? ... On the next iteration the loop variable would be bound with WITH to ... the constructs collect and collecting collect ... The argument var is set to the ...
    (comp.lang.lisp)
  • wait for event
    ... carry out a loop. ... var XYZDlg = function{ ... // This fires when the load event is initiated ...
    (comp.lang.javascript)
  • Dynamically generated functions not behaving as expected...
    ... that existed in the last iteration of the loop to all previous ... var ary = new Array; ... affect -- creating dymamic functions with varied data while iteration ...
    (comp.lang.javascript)