文档介绍:IT-Homer 专栏
成功是优点的发挥,失败是缺点的积累! 不为失败找理由,只为成功找
方法……
Get the content of an Iframe in Javascript – crossbrowser solution for both
IE and Firefox
分类: Script 2010-09-10 16:48 190人阅读评论(0) 收藏举报
Get the content of an Iframe in Javascript – crossbrowser solution for both IE and
Firefox
http://roneiv./2008/01/18/get-the-content-of-an-iframe-in-javascript-crossbrowser-
solution-for-both-ie-and-firefox/
 
 
Ok, let’s imagine the use case: I have an iframe somewhere on my page, and when I click a link or a
button I need to get the content of it (could be a textarea .), and then do some stuff with it.
It was easy to do this in IE, but for Firefox I struggled more, as I kept getting the “frame has no
properties” error message in the console. And when I solved this I couldn’t get to the content.
There is a lot of references out there claiming that you could use ['nameOfMyIframe']
or ['nameOfMyIframe'] to get the frame, and then use the .innerHTML to get the con