Javascript插入IFRAME [英] Javascript to insert IFRAME
问题描述
我想让人们能够在他们的网站中插入一个Javascript行,这实际上允许我插入一个包含我网站内容的固定大小的IFRAME。它实际上是一个小部件,允许他们搜索我的网站或接收其他信息。这可能吗?
I'd like to give people the ability to insert a single Javascript line into their site which effectively allows me to insert an IFRAME of a fixed size that contains content from my site. It's effectively a widget which allows them to search my site or receive other information. Is this possible?
推荐答案
是的,有可能。
您可以使用document.createElement( iframe)然后appendChild()或replaceChild()新元素= / [如果你使用replaceChild,你定义一个具有iframe宽度/高度的虚拟div]
Yes, it is possible.
You can use document.createElement("iframe") and then appendChild() or replaceChild() the new element =/ [if you use replaceChild, you define a dummy div that has the width/height of your iframe]
或者我是否错误地解释了您的问题?
Or am I interpreting your question incorrectly?
这篇关于Javascript插入IFRAME的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!