如何复制iframe的内容 [英] How to copy contents of Iframe

查看:211
本文介绍了如何复制iframe的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想复制从文本框中键入的iframe的所有内容,当我单击电子邮件选项时,必须将所有内容邮寄给收件人.

如果有人知道该解决方案确实对我有所帮助....

解决方案

使用以下机制,我们可以访问iframe的内容.

< iframe id ="e_body"名称="e_body" src ="somepage.html"></iframe>

要访问内部内容,请使用以下语法

e_body.document.body.innerHTML

您可以对此进行更多的探索以满足您的需求.

希望这会有所帮助!


使用jquery很容易-

.contents()




示例之一

 <  !DOCTYPE     html  > 
<   html  > 
<  头部 > 
  <  脚本    ="   http://code.jquery.com/jquery-latest. js" <  > 
<  /head  > 
<  正文 > 
    <   iframe     ="   http://api.jquery.com/"   宽度  ="  80%" 高度   600"  id   ='  frameDemo' >  <  /iframe  > 
<  脚本 >  

(#frameDemo").contents().find("a").css("background-color",#BADA55"); < /script > < /body > < /html >




检查jquery http://api.jquery.com/contents/ [ 解决方案

Using following mechanism we can access contents of iframe.

<iframe id = "e_body" name = "e_body" src="somepage.html"></iframe>

To access inner content use following syntax

e_body.document.body.innerHTML

You can explore more on this to satisfy your demand.

Hope this will help!


its quite easy with the jquery --

.contents()




one of the example

<!DOCTYPE html>
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
    <iframe src="http://api.jquery.com/" width="80%" height="600" id='frameDemo'></iframe>
<script>


("#frameDemo").contents().find("a").css("background-color","#BADA55");</script> </body> </html>




check jquery
http://api.jquery.com/contents/[^]


这篇关于如何复制iframe的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆