为什么要用js呢,不是这样也可以吗
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">弹窗</button>
<div class="modal" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button class="close" type="button" data-dismiss="modal">
<span>×</span><span class="sr-only">关闭弹窗</span>
</button>
<h4 class="modal-title" id="myModalLabel">这是弹窗</h4>
</div>
<div class="modal-body">
这是弹窗内容!
</div>
<div class="modal-footer">
<button class="btn btn-default" type="button" data-dismiss="modal">关闭</button>
<button class="btn btn-primary" type="button" >保存</button>
</div>
</div>
</div>
</div>