我的 Home.asp 上有一个打开模式的登录按钮。我有另一个页面,其中有一个登录/注销按钮。如何从此页面的主页调用模式。
首页。 aspx代码:
<a href="#" data-target="#ModalCLogin" data-toggle="modal"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
第二页代码:(在此链接上单击我想从 Home.aspx 调用模态)
<a href="#" data-target="#ModalCLogin" data-toggle="modal"><span class="glyphicon glyphicon-log-in"></span> Login</a>
最佳答案
我遇到了同样的问题,我在 this link 中找到了解决方案。 假设您有 2 个页面,
First.html --> 包含模式 anchor
Second.html --> 包含模态框的定义
基本上,您需要在“Second.html”中href模态的位置和数据目标模态的ID
<li><a href="Second.html" data-target="#theModal" data-toggle="modal">Lab 6</a></li>
然后仍然在 First.html 中,您需要使用 id 定义模式,直到 modal-content
<div class="modal fade text-center" id="theModal">
<div class="modal-dialog">
<div class="modal-content">
</div>
</div>
</div>
在 Second.html 上,您定义 modal-content 内的内容
<div class="modal-header">
...
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
...
</div>
这对我有用。所有积分均归Buzinas谁在我上面提供的链接上回答了这个问题
关于javascript - 如何从另一个页面打开 Bootstrap 模式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35118033/