Why is this? Is it because <a> are not part of document.forms? More importantly how would I go through all html tags?
05-20-2011, 07:48 AM
indianapolymath
Clarification
I am loading a aspx page into a frame and trying to access that page's elements from another frame. To get the run-time created names, I am performing the code above.
05-20-2011, 07:52 AM
Kor
Yes, <A></A> is not an element of a form. In order to circle to all the HTML tags, you may use the method getElementsByTagName(), and a wild card "*"
Code:
var myFrame=parent.document.getElementsByName('framename')[0];
var allElements=myFrame.contentWindow.document.getElementsByTagName('*');
You may circle also trough oll the elements with a certain node (tag) name, let's say all the links and anchors: