重新加载或刷新嵌入标记中的 HTML
Reload or refresh an HTML embed in an embed tag
我有一个内部应用程序,我需要不时刷新但不太喜欢放置内部刷新或重新加载计时器,只需要一个按钮来执行此操作并且大多数情况下都是因为文档是msql 结果页面已经完整,如果可以的话,我想将它保留在嵌入标记中!我已经尝试过了,但是重新加载 div 中的所有内容,然后如果我刷新所有内容,我会得到
To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier. RESEND or CANCEL
并且我不想重复任何操作。
<script>
function reload() {
document.getElementById("myhtml").contentDocument=location.reload();
}</script>
<input type="button" value="Reload" onclick="reload()" >
<embed id="myhtml" type="text/html" src="html.php" width="100%" height="100%">
+----------------------------------------------------+
| +-----+ +----------------------------------------+ |
| | | | | |
| | | | | |
| | | | | |
| | div | | embed id="myhtml" | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| +-----+ +----------------------------------------+ |
+----------------------------------------------------+
我测试过
function reload() {
document.getElementById("myhtml").innerHTML=location.reload();
}
您无法加载特定的 div。
location.reload() 用于重新加载页面 no 重新加载 div.
将您的代码更改为:
document.getElementById("myhtml").src="html.php"
我有一个内部应用程序,我需要不时刷新但不太喜欢放置内部刷新或重新加载计时器,只需要一个按钮来执行此操作并且大多数情况下都是因为文档是msql 结果页面已经完整,如果可以的话,我想将它保留在嵌入标记中!我已经尝试过了,但是重新加载 div 中的所有内容,然后如果我刷新所有内容,我会得到
To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier. RESEND or CANCEL
并且我不想重复任何操作。
<script>
function reload() {
document.getElementById("myhtml").contentDocument=location.reload();
}</script>
<input type="button" value="Reload" onclick="reload()" >
<embed id="myhtml" type="text/html" src="html.php" width="100%" height="100%">
+----------------------------------------------------+
| +-----+ +----------------------------------------+ |
| | | | | |
| | | | | |
| | | | | |
| | div | | embed id="myhtml" | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| +-----+ +----------------------------------------+ |
+----------------------------------------------------+
我测试过
function reload() {
document.getElementById("myhtml").innerHTML=location.reload();
}
您无法加载特定的 div。
location.reload() 用于重新加载页面 no 重新加载 div.
将您的代码更改为:
document.getElementById("myhtml").src="html.php"