lilman Posted August 16, 2007 Share Posted August 16, 2007 I have a button, and when you click it, ideally, I'd like it to show the HTML. I have an iFrame with the id attribute valued as viewLook. So I am trying to view the HTML using a button which calls a function that has this code: var obj=document.getElementById("viewLook").contentWindow.document.innerText; document.write(obj); However, it always comes back undefined. Any help would be great. Quote Link to comment Share on other sites More sharing options...
adam84 Posted August 17, 2007 Share Posted August 17, 2007 I am pretty sure that an Iframe will only load a page. So the only info you can get back would be the current src that the iFrame is currently pointing to. I could also be a big fat liar Quote Link to comment Share on other sites More sharing options...
nogray Posted August 20, 2007 Share Posted August 20, 2007 innerText works only in IE, use innerHTML instead. Also, you should have the body with the document contentWindow.document.body.innerHTML Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.