L
Luke
Elements with name attribute:
form, input, textarea, a, frame, iframe, button, select, map, meta,
applet, object, param, img (if you know more reply...)
Methods of addresing html elements:
<form name="myform">
<input name="myinput" />
</form>
1. var input = document.forms.myform.myinput;//from nn3+
2. var input = document.forms["myform"].myinput;//from nn3+
3. var input = document.forms[0].myinput;//from nn3+, if form is first
in html
<form id="myform">
<input name="myinput" id="myinput"/>
</form>
4. var input = document.all.myform.myinput;//from ie4+
5. var input = document.all["myform"].myinput;//from ie4+
6. var input = document.all("myform").myinput;//from ie4+
7. var input = myform.myinput;//from ie4+, dropped document.all
8. var input = document.all.item("myform").myinput;//from ie4+
9. var input = document.all.item("myinput");//from ie4+
10. var input = document.getElementById("myinput");//DOM
Questions:
1.
My question is about form showed in points 1,2,3. Does this form can be
applied to form like this (with id, without name attr):
<form id="myform">
</form>
....
document.forms.myform;
....
2.
Does forms showed in points 1,2,3 are most supported by different
browsers ? (also with support addresing via id attr and name attr).
3.
Does forms showed in points 4,5,6,7,8,9 can also be used with form that
have only name attr (without id):
<form name="myform">
</form>
....
document.all.myform;
....
4.
Do you know different ways of addressing elements in html and which is
most commonly supported by wide spread of different browsers ?
Thanks for answer in advance
form, input, textarea, a, frame, iframe, button, select, map, meta,
applet, object, param, img (if you know more reply...)
Methods of addresing html elements:
<form name="myform">
<input name="myinput" />
</form>
1. var input = document.forms.myform.myinput;//from nn3+
2. var input = document.forms["myform"].myinput;//from nn3+
3. var input = document.forms[0].myinput;//from nn3+, if form is first
in html
<form id="myform">
<input name="myinput" id="myinput"/>
</form>
4. var input = document.all.myform.myinput;//from ie4+
5. var input = document.all["myform"].myinput;//from ie4+
6. var input = document.all("myform").myinput;//from ie4+
7. var input = myform.myinput;//from ie4+, dropped document.all
8. var input = document.all.item("myform").myinput;//from ie4+
9. var input = document.all.item("myinput");//from ie4+
10. var input = document.getElementById("myinput");//DOM
Questions:
1.
My question is about form showed in points 1,2,3. Does this form can be
applied to form like this (with id, without name attr):
<form id="myform">
</form>
....
document.forms.myform;
....
2.
Does forms showed in points 1,2,3 are most supported by different
browsers ? (also with support addresing via id attr and name attr).
3.
Does forms showed in points 4,5,6,7,8,9 can also be used with form that
have only name attr (without id):
<form name="myform">
</form>
....
document.all.myform;
....
4.
Do you know different ways of addressing elements in html and which is
most commonly supported by wide spread of different browsers ?
Thanks for answer in advance