如何在iframe中插入html [英] How to insert html in iframe
本文介绍了如何在iframe中插入html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
....
$ b $所有:我需要在iframe中插入一个html字符串,如下所示: b
var html =< html>< head>< title> Titolo< / title>< / head>< body>< p> body< p为H.< /体>< / HTML>中
jQuery('#popolaIframe')。click(function(){
parent。$(#indexIframe)[0] .documentElement.innerHTML = html;
} );
有没有办法达到这个目的?
jQuery('#popolaIframe')。click(function(){
var doc = parent。$(#indexIframe)[0] .documentElement;
doc。 open();
doc.write(html);
doc.close();
});
Hallo all: I need to insert a html string in a iframe as shown below:
....
var html = "<html><head><title>Titolo</title></head><body><p>body</p></body></html>"
jQuery('#popolaIframe').click(function() {
parent.$("#indexIframe")[0].documentElement.innerHTML = html;
});
Is there a way to achieve this?
解决方案
var html = "<html><head><title>Titolo</title></head><body><p>body</p></body></html>"
jQuery('#popolaIframe').click(function() {
var doc = parent.$("#indexIframe")[0].documentElement;
doc.open();
doc.write(html);
doc.close();
});
这篇关于如何在iframe中插入html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文