首页 > 解决方案 > 单击窗口特定部分的菜单栏按钮后,我们如何打开 Html 页面?

问题描述

单击菜单后,特定的 html 页面应该在窗口的一部分上打开我如何使用 div 标签来做到这一点?你能告诉我一些例子吗?现在我在 Frame 标签的帮助下执行此操作,但还有另一种选择,在此先感谢。

标签: html

解决方案


如果我理解正确,您想通过单击按钮在页面上打开一个带有 html 的弹出窗口,您可以这样做

function openHtml()
{
   document.getElementById("html_block").innerHTML = "YourHTML..."; //simple way
   //$("#target_div").load("YOUR_PAGE.html"); //you can also use this to load html from file using jquery
}
.main_page
{
 width: 100%;
 height: 200px;
 background: grey;
 position: relative;
}
#html_block
{
  position: absolute;
  background: red;
  left: 80%; /*your specific position*/
  bottom: 10px;
}
<div class="main_page">
  <button onclick="openHtml()">open html</button>
  <div id="html_block"></div>
</div>


推荐阅读