bootstrap的一个js效果,在慕课练习上可以出效果,在自己写的html中不能出效果
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" href="test1/dist/css/bootstrap.min.css" media="screen" title="no title" charset="utf-8"> </head> <body> <button class="btn btn-primary" type="button" name="button">点击我</button> <div class="modal" id="mymodal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button class="close" data-dismiss="modal" type="button" name="button"> <span aira-hidden="true">×</span> <h4 class="modal-title">这是一个标题</h4> </button> </div> <div class="modal-body"> <p> 这是一个内容 </p> </div> <div class="modal-footer"> <button class="btn btn-default" data-dismiss="modal" type="button" name="button">关闭吧</button> <button class="btn btn-primary" type="button" name="button">还是保存吧</button> </div> </div> </div> </div> <script src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script> <script scr="test1/dist/js/bootstrap.min.js"></script> <script type="text/javascript"> $(function(){ $(".btn").click(function(){ $("#mymodal").modal("toggle") })}) </script> </body> </html>
bootstrap的css js 导入路径都是正确的,不知道为什么出不来效果