2017-06-14 138 views
-1

我想開發一個簡單的前端用於顯示使用BootStrap的圖像。然而,在使用BootStrap之前,查看圖像的按鈕工作正常,但是在使用引導程序設置頁面樣式之後,它什麼都不做,任何人都可以告訴我我做錯了什麼?當我試圖在Chrome的開發者工具看,我得到2個例外:BootStrap提交按鈕不起作用

Uncaught Error: You must include the utils.js file before tether.js 
    at tether.js:4 
(anonymous) @ tether.js:4 
bootstrap.min.js:7 Uncaught ReferenceError: Tether is not defined 

代碼:

<html lang="en"> 


    <head> 
     <meta charset="UTF-8"> 
     <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
     <meta name="viewport" content="width=device-width, initial-scale=1"> 

     <title></title> 
     <script src="script/tether.min.js"></script> 
     <script src="script/tether.js"></script> 
     <script src="script/jquery.min.js"></script> 


     <link rel="stylesheet" href="css/bootstrap.min.css"></link> 
     <link rel="stylesheet" href="css/styles.css"></link> 

     <script src="script/bootstrap.min.js"></script> 


    </head> 
    <body> 
     <h1 class="mt-4" align='center'> Demo Website </h1><br> 

     <div class="container" style="width:300px; background-color:ghostwhite;"> 

       <div class="form-group"> 


       <form action='viewimages2.php' method="GET"> 
        <button class="btn-block btn btn-info" align='center' type="submit" name="Submit"> View Images </button> 
       </form> 

     </div> 


    </body> 
</html> 

工作代碼,而無需引導:

<!DOCTYPE html> 
<!-- 
--> 
<html> 
    <head> 
     <meta charset="UTF-8"> 
     <title></title> 
    </head> 
    <body> 
     <H1 align='center'>Demo Website/h1><br> 
     <button align='center' type="button" onclick="window.location='Register.php';" value="Register"> Register </Button> 
     <button align='center' type="button" onclick="window.location='Login.php';" value="Login"> Login </Button> 
     <form action='viewimages2.php' method="GET"> 
      <button type='submit' name="Submit"> View Images </button> 
     </form> 


    </body> 
</html> 
+0

什麼是不清楚「你必須包括utils.js文件tether.js之前」? – Quentin

+0

由於在tether.js之前包含utils.js給出了相同的異常,但在通過Swellar嘗試解決方案後現在被清除,但按鈕仍然不起作用 – user3930213

回答

0

你可以試試這個,把jquery.min.js之前的其他.js文件。我想你可以刪除tether.js,因爲你已經在使用tether.min.js

<script src="script/jquery.min.js"></script> 
<script src="script/tether.min.js"></script> 
+0

錯誤消息指出缺少'utils.js'。你爲什麼要移動'jquery.min.js' ?! – Quentin

+0

現在沒有異常,但按鈕仍然不起作用 – user3930213

+0

@Quentin我認爲'utils.js'是'jquery.min.js'的一部分,並且大多數情況下,將'jquery.min.js'移動到最頂層可以解決許多與功能無關的問題 – Swellar