在IFrame中加载HTML内容 [英] Loading HTML contents in IFrame

查看:101
本文介绍了在IFrame中加载HTML内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我想在IFrame中加载HTML内容.
我尝试使用IFRame的"innerHTML"属性,但未能获得响应.但条件是我不想使用Iframe的src属性

请在正确的指导下为我提供帮助

Hello,

I want to load a HTML content in IFrame.
I tried "innerHTML" property of IFRame but failed to get a response.But the condition is I don''t want to use the src attribute of Iframe

Please help me with proper guidance

推荐答案

您应该可以通过以下方法进行操作:

You should be able to do this in the following approach:

var iframe = document.getElementById(''IFRAME ID''); // Get the iframe using it''s ID

iframe .src = ''//Set URL here'';


如果您需要使用< a>标记,则将如下所示:

if u need to use the <a> tag ,then it will be as following :

<iframe id="myframe"></iframe>
   <a href="url" target="frameId">pageName</a>


这篇关于在IFrame中加载HTML内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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