所以基本上我想要实现的是从另一个 html 文件获取引导模式的内容,而不是将模式内容放在索引 html 文件上(因为我需要多次使用它)。
我尝试从高处和低处寻找答案,最接近的是:Getting Bootstrap's modal content from another page
但是,我有一个问题,因为它没有显示任何模式内容。它只是显示一个空白模式,我不知道我哪里出了问题。
以下是我的相关代码: 主要 HTML:
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-bar-chart-o fa-fw"></i> Pre-IDA Test
</div>
<div class="panel-body">
<div id="chartdiv" style="width: 100%; height: 400px;"></div>
<script> pretest() </script>
<a href="pretestmodal.html" class="btn btn-info" data-toggle="modal" data-target="#testing">View Data</a>
<div id="testing" class="modal fade" role="dialog" tabindex="-1" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
</div>
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
模态内容:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> …Run Code Online (Sandbox Code Playgroud)