为什么赢了';我的引导javascript不能在本地运行吗?

为什么赢了';我的引导javascript不能在本地运行吗?,javascript,html,bootstrap-modal,Javascript,Html,Bootstrap Modal,所以我想我应该给你我的代码来解释我的问题 <!DOCTYPE html> <html> <head> <title>User Guide</title> <link rel="stylesheet" href="style.css" type="text/css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/

所以我想我应该给你我的代码来解释我的问题

<!DOCTYPE html>
<html>
<head>
<title>User Guide</title>
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
</head>
<body>

<!-- Button trigger modal -->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
  Launch demo modal
 </button>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
    <h4 class="modal-title" id="myModalLabel">Modal title</h4>
  </div>
  <div class="modal-body">
    ...
  </div>
  <div class="modal-footer">
    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
    <button type="button" class="btn btn-primary">Save changes</button>
  </div>
  </div>
  </div>
</div>
<footer>
    <script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script>
    <script src="modal.js"></script>
</footer>
</body>
</html>

用户指南
启动演示模式
&时代;
情态标题
...
接近
保存更改
就在那里。但是由于某些原因,引导js脚本没有运行,所以当我点击按钮时,什么都没有发生

有人能帮我吗

谢谢,
Jonathan

这是因为您使用的是一个与协议相关的jQuery URL。您应该在浏览器的控制台中看到错误

尝试更改:

<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>

致:



当您在浏览器(web服务器外部)本地打开文件时,大多数浏览器将使用
文件://
协议,所以
//code.jquery.com/jquery-1.11.3.min.js
变成了
file://code.jquery.com/jquery-1.11.3.min.js
很可能您没有jQuery这个位置。

这是因为您正在使用协议相对URL进行jQuery。您应该在浏览器的控制台中看到错误

尝试更改:

<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>

致:



当您在浏览器(web服务器外部)本地打开文件时,大多数浏览器将使用
文件://
协议,所以
//code.jquery.com/jquery-1.11.3.min.js
变成了
file://code.jquery.com/jquery-1.11.3.min.js
很可能你没有jQuery这个位置。

你在使用Web服务器吗?你是说你在运行本地Web服务器,对吗?是的,我猜这是暗示Lol你在使用Web服务器吗?你是说你在运行本地Web服务器,对吗?是的,我猜这是暗示Lol刚刚意识到,也没有使用正确的引导脚本刚刚意识到,也没有使用正确的引导脚本