1, IE-specific (through the frames Index image positioning): Document.frames[i].document.getelementbyid (' element id ');
2, IE-specific (through the name image of the IFRAME positioning): document.frames[' iframe name '].document.getelementbyid (' element id ');
The above method not only applies to the IFRAME, but also applies to the frame in the frameset. IE is good at customizing standards, but it has to say that many of the design is still relatively human. This, for example, provides a concise and figurative representation of the same standard path that is supported below.
3, the common method: document.getElementById (' The ID of the IFRAME '). ContentWindow.document.getElementById (' ID of element ')
Note that to add Contentwindow, often the problem is because this is easy to ignore, it represents the frame and inside the IFrame window object.
But, obviously, the wording was very, very long. If you want to operate a series of elements inside, so it is enough to write, even with copy and paste Dafa, the eye is also a problem.
4, the general method of shorthand:
Define a short name for document.getElementById, and friends who are slightly familiar with JS know this method. Here it can play a double role, as in the following example:
var $id =document.getelementbyid;
$Id (' The ID of the IFRAME '). Contentwindow. $Id (' ID of element ')//* So you get the object you want to take
At this point, I still like IE practice, more care. Because Microsoft is not a separate browser developer, it also has to write a large number of development html/asp documents, so compare can do this. and other browser developers, basically just stand in a browser position, the most basic link to the finished, and rarely stand in the developer's position to design some such a simple and semantic shortcuts. Many people often say that their "standards" are justified in some places, but in some places such standards are merely indifference.
The above quick get/Set the object element in the IFRAME several JS implementation method is small series to share all the content, hope to give you a reference, also hope that we support cloud habitat community.