twitter-bootstrap 引导按钮不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28971354/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 22:25:42  来源:igfitidea点击:

Bootstrap buttons not working

twitter-bootstrapbutton

提问by John Smith

Hello I am making a button and for some reason when I click on it I does not open Projects.php, and I can not find out why it does not work here is my code:

你好,我正在制作一个按钮,出于某种原因,当我点击它时,我没有打开 Projects.php,我不知道为什么它不起作用,这是我的代码:

<h1>Projects</h1>

<p> Some text</p>

<button type="button" class="btn btn-default" href="Projects.php">View details ?</button>

I have the following libraries linked:

我链接了以下库:

<link href="css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>

I download the bootstrap file from the bootstrap site and put the folders in my directory. My file is saved as index.php (because php code is my file)

我从引导程序站点下载引导程序文件并将文件夹放在我的目录中。我的文件保存为index.php(因为php代码是我的文件)

Any help is appreciated!

任何帮助表示赞赏!

回答by isherwood

Buttons don't act as links unless they're in a form (more on that). I don't think you want the behavior of a button anyway. Do this:

按钮不作为链接,除非它们在一个表单中(更多关于那个)。我不认为你想要按钮的行为。做这个:

<a class="btn btn-default" href="Projects.php">View details ?</a>

回答by tylerson luiz

If you are using bootstrap 3.1.1 then in your script at the bottom, you should import jquery v1.11.0 instead of v1.11.2

如果您使用的是 bootstrap 3.1.1,那么在底部的脚本中,您应该导入 jquery v1.11.0 而不是 v1.11.2