1, ie dedicated (through frames index image positioning):
Document.frames[i].document.getelementbyid (' element id ');
2, IE dedicated (through the IFRAME name image positioning):
document.frames[' iframe name '].document.getelementbyid (' element id ');
The above method applies not only to the IFRAME, but also to the frame in the frameset. ie, although good at self-defined standards, but have to say that many of its design is more humane. For example, it provides a concise and figurative way of writing in addition to the standard paths below.
3. General Method:
document.getElementById (' ID of iframe '). Contentwindow. document. getElementById (' element ID ')
Note To add Contentwindow, the problem often arises because it is easy to ignore, it represents the window object inside the frame and the iframe .
JS Get IFRAME Document content
<script type= "Text/javascript" > Function getiframecontent () { //Get iframe file contents var doc;if (document.all) {// IE doc = document.frames["Myiframe"].document; }else{//Standard doc = document.getElementById ("Myiframe"). Contentdocument;} return Doc.body.innerHTML;} </script>
Note: The above. Contentdocument equals. contentwindow.document!
Extended reading:
Practical Framework (IFRAME) code
JS get/Set Several methods of object elements and documents in IFRAME