简体   繁体   中英

Posting a form to an iframe and get back the content from iframe with javascript?

I am working on a website in which i need get content from iframe. code is here.

<!DOCTYPE html>
<html>
<head>
    <script src="http://code.jquery.com/jquery-lates…
</head>
<body>
    <iframe src="http://glimmertech.org/IF222.htm" width="80%" height="600" id="frameDemo">       </iframe>

    <script>
    var myFrame = $('#frameDemo');

    myFrame.load(function()
    {
       var myjQueryObject = $('#frameDemo').contents().find('#newid'…
       alert(myjQueryObject[0].innerHTML);
    });
    </script>
</body>
</html>

Try this:

 var myIframe = document.getElementById('frameDemo');
 var myObject = myIframe.contentWindow.document.getElementById('newid');
 alert(myObject.innerHTML);

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