简体   繁体   中英

how to get iframe body text using javascript

here are 02 pages:

Some content is here.

<iframe id="sumon_iframe" src="iframe_content.php"></iframe>
<script language="JavaScript" type="text/javascript">
  var iframe_id=document.getElementsByTagName('iframe')[0].id; //i get it perfectly
  var content=iframe_id.body.innerHTML; //i don't get value
  alert(content);
</script>

How do I get the iframe 's innerHTML ( Some content is here )in iframe.php page using Javascript?

you must use

iframe.contentDocument

or

iframe.contentWindow

for ie

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM