1.須要引用bootstrap的js、css文件,且需引用jquery文件,由於bootstrap的js依賴jqueryjavascript
<script type="text/javascript" src="../assets/js/jquery.2.1.1.min.js"></script> <script type="text/javascript" src="../assets/js/bootstrap.js"></script> <link rel="stylesheet" href="../assets/css/bootstrap.css"/>
2.詳細說明:css
<button class="btn btn-primary form-control" data-toggle="modal" data-target="#myModal">彈出模態框</button> <div class="modal fade" id="myModal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button class="close" data-dismiss="modal" aria-hidden="true">×</button> 標題 </div> <div class="modal-body">您有一條新短消息,請注意查收!</div> <div class="modal-footer"><button class="btn btn-info" data-dismiss="modal">確認</button></div> </div> </div> </div>