Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iframe。在其中显示另一个html页面;最简单的实现是什么?_Html_Iframe - Fatal编程技术网

iframe。在其中显示另一个html页面;最简单的实现是什么?

iframe。在其中显示另一个html页面;最简单的实现是什么?,html,iframe,Html,Iframe,这是我试过的 在html主页中 <iframe src="./example.html" id="frame" frameborder="1"></iframe> example.html如下所示 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <htm

这是我试过的

在html主页中

 <iframe src="./example.html" id="frame" frameborder="1"></iframe>

example.html如下所示

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Example</title>
</head>

<body>
<p>YOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</p>
</body>

例子
呜呜呜呜呜呜呜呜呜呜

这将导致iframe为空

--更新--


好的,问题是仅仅刷新页面并没有更新iframe。但当我把它关起来重新打开时,一切都很好。有人能解释一下吗?iFrame是否需要刷新?

Example.html应该是:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Example</title>
</head>

<body>
<p>YOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO</p>
</body>
</html>

例子
呜呜呜呜呜呜呜呜呜呜


还要确保您的iframe中指向example.html的路径正确,并且具有设置的高度和宽度。

您得到的是空的iframe吗?控制台中有任何错误吗?您确定src正确吗?在example.html的末尾添加
,以防您没有它…@Sergio Yes empty iframe。。补充说,这是失踪,但没有改变欢呼。Mataniko是的我认为src是对的。。它是一个名为example.html的文件,与主html文件位于同一文件夹中,在ITI中包含iframe如果您查看主html的源代码并遵循iframe src的链接(单击查看源代码中的链接),会发生什么?