Getting elements of an iframe in javascript

Iframe always get through the frames collection of a document through document.frames (not through
document.getElementById("iFrameId")).
Hear is the code below to getting the reference of an iframe elements.


<script type='text/javascript'>


  // Through Position of iframe in document
  var frame = frames[v];
  frame.document.getElementById('Table4').style.display = "none";

  // Through id of iframe
  var frame =  frames["MyFrame"];
  frame.document.getElementById('Table4').style.display = "none";


 //do whatever you need with the content of iframe

</script>


Popular Posts