I just discovered that I cannot manipualte multiple DIVs using Javascript's document.getElementsByName().
Apparently, there is no legal way of using the name attribute for such tags such as div or span, according to W3C HTML 4.01 specs. You must confine the usage of this attribute to such tags as input, img, frame, iframe, form, map, param, meta, object, A, select, applet, textarea, or button.
Click Here.
So remember to use document.getElementsByTagName() instead and go through all DIVs and check for a user-defined attribute to achieve your goal. Although this seems inefficient if you have a lot of DIVs, it's legal and the DOM model should be efficient enough to not cause too much processing time.
Also bear in mind that replacing document.getElementsByName() with document.getElementsByTagName() may not be backward compatible with some older browsers such as IE4.
Tuesday, March 21, 2006
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment