chuvak
07-07-2003, 05:58 PM
Hi,
I am having troubles understanding how those NAME and ID attributes work.
For example if I have a form
<form name="f1">... <table><tr><td><input name="i1"...
then I can access that input by document.f1.i1
if instead of a form there was a div, then it wouldn't work and I 'd have to put a name on each parent tag of my input in order to access it like this:
<div name="d1">... <table name="t2"><tr name="tr"><td name="td"><input name="i1"...
document.d1.t2.tr.td.i1
Why is this the case? Do forms handle NAMEs in a special way?
Same with IDs. If I don't want to use getElementById will I have to give an ID to each tag that encloses the tag I want to access?
thanks in advance
I am having troubles understanding how those NAME and ID attributes work.
For example if I have a form
<form name="f1">... <table><tr><td><input name="i1"...
then I can access that input by document.f1.i1
if instead of a form there was a div, then it wouldn't work and I 'd have to put a name on each parent tag of my input in order to access it like this:
<div name="d1">... <table name="t2"><tr name="tr"><td name="td"><input name="i1"...
document.d1.t2.tr.td.i1
Why is this the case? Do forms handle NAMEs in a special way?
Same with IDs. If I don't want to use getElementById will I have to give an ID to each tag that encloses the tag I want to access?
thanks in advance