本文介绍了使用JavaScript从iframe获取内部HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的朋友们,我开发了一个项目,因为我想以表格的形式显示来自网站的数据.因此,我可以在子窗口iframe中执行此过程,并将表内容从子窗口获取到父窗口.所有人都工作正常,但是这将适用于所有浏览器,例如.并且不会显示任何错误,一个朋友给出答案( http://roneiv.wordpress.com/2008/01/18/get-the-content-of-an-iframe-在javascript-crossbrowser-solution-for-the-ie-and-firefox/中),但显示错误访问被拒绝",请帮助我.

Hi friends i develop a project , in that i want to show the data from a website in the form of table . So i can do the process in child window iframe and get the table content from child window to the parent window . All are working fine , But this will work all browsers except ie. and it wont display any errors , One friend give the answer ( http://roneiv.wordpress.com/2008/01/18/get-the-content-of-an-iframe-in-javascript-crossbrowser-solution-for-both-ie-and-firefox/)for this but it shows the Error "Access denied" , Please help me..

推荐答案

这是因为您在iframe中引用的网站位于另一个域上.在您回复的原始帖子中,我误解了并认为您说它们在同一个域中.引用另一个论坛:由于i框架来自其他网站,因此您无法阅读i框架的任何内部属性."[ http://www.experts-exchange.com/Software/Server_Software/Application_Servers/Java/Apache_Tomcat/Q_22843851.html ]

It is because the site you are referencing in the iframe is on another domain. In your original post that I responded to, I misunderstood and thought you said they were on the same domain. Quoting another forum:"As the i-frame is from a different website you cannot read any of the inner properties of the i-frame."[http://www.experts-exchange.com/Software/Server_Software/Application_Servers/Java/Apache_Tomcat/Q_22843851.html]

我不知道您在做什么,甚至可以,但是如果可以,我相信这里的人可以提供帮助.

I don't know that what you are doing is even possible, but if it is, I'm sure someone on here can help.

这篇关于使用JavaScript从iframe获取内部HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 23:46