bootstrap弹出模式没有打开

时间:2017-04-30 14:01:04

标签: php twitter-bootstrap bootstrap-modal

制作了一个带有表单字段的bootstrap弹出窗口。在W3编辑器中它工作正常。但是在我的脚本中,当我单击模态按钮时,没有任何反应。它是一个.php文件。

在论坛上搜索并找到了一些主题,但找不到错误。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Exportzendingen</title>

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.15/css/jquery.dataTables.css">
    <link rel="stylesheet" href="export/datatables.css">

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
    <script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.15/js/jquery.dataTables.js"></script>
</head>

<body>
     <nav class="navbar navbar-inverse ">
          <div class="container-fluid">
            <div class="navbar-header">
              <a class="navbar-brand" href="#">Exportzendingen</a>
            </div>
            <ul class="nav navbar-nav">
              <li class="active"><a href="#">Overzicht</a></li>
            </ul>


                    <!-- Button trigger modal -->
            <button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModalNorm">
                Zending Toevoegen
            </button>

            <!-- Modal -->
            <div class="modal fade" id="myModalNorm" tabindex="-1" role="dialog" 
                 aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <!-- Modal Header -->
                        <div class="modal-header">
                            <button type="button" class="close" 
                               data-dismiss="modal">
                                   <span aria-hidden="true">&times;</span>
                                   <span class="sr-only">Close</span>
                            </button>
                            <h4 class="modal-title" id="myModalLabel">
                                Zending Toevoegen
                            </h4>
                        </div>

                        <!-- Modal Body -->
                        <div class="modal-body">

                              <form action="insert.php" method="post">
                                <div class="form-group">
                                  <label for="email">Debiteur:</label>
                                  <input type="text" class="form-control" name="deb_nmr" id="debiteur" placeholder="Debiteurnummer invoeren">
                                </div>
                                <div class="form-group">
                                  <label for="pwd">Klantnaam:</label>
                                  <input type="text" class="form-control" name="cost_name" id="costname" placeholder="Klantnaam invoeren">
                                </div>
                                <div class="form-group">
                                  <label for="pwd">Aantal Pallets:</label>
                                  <input type="text" class="form-control" name="numb_pal" id="numbpal" placeholder="Aantal pallets invoeren">
                                </div>
                                <div class="form-group">
                                  <label for="pwd">Totaal gewicht:</label>
                                  <input type="text" class="form-control" name="tot_weight" id="totweight" placeholder="Totaal gewicht invoeren + kg">
                                </div>
                                <div class="form-group">
                                  <label for="pwd">PB nummers:</label>
                                  <input type="text" class="form-control" name="pb_s"id="pbs" placeholder="Pakbonnummers invoeren + pb">
                                </div>
                                <input type="submit" value="submit">
                               </form>


                        </div>

                                <!-- Modal Footer -->
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-default"
                                            data-dismiss="modal">
                                                Close
                                    </button>
                                </div>
                      </div>
                    </div>
              </div>
         </div>
    </nav>   
</body>
</html>

1 个答案:

答案 0 :(得分:1)

您需要添加bootstrap.min.js

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Exportzendingen</title>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.15/css/jquery.dataTables.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
  <script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.15/js/jquery.dataTables.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>

检查:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.15/css/jquery.dataTables.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
  <script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.15/js/jquery.dataTables.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
  
  <nav class="navbar navbar-inverse">
    <div class="container-fluid">
      <div class="navbar-header">
        <a class="navbar-brand" href="#">Exportzendingen</a>
      </div>
      <ul class="nav navbar-nav">
        <li class="active"><a href="#">Overzicht</a></li>
      </ul>

      <button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModalNorm">
      Zending Toevoegen
      </button>

      <div class="modal fade" id="myModalNorm" tabindex="-1" role="dialog" 
        aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" 
                data-dismiss="modal">
              <span aria-hidden="true">&times;</span>
              <span class="sr-only">Close</span>
              </button>
              <h4 class="modal-title" id="myModalLabel">
                Zending Toevoegen
              </h4>
            </div>
            <div class="modal-body">
              <form action="insert.php" method="post">
                <div class="form-group">
                  <label for="email">Debiteur:</label>
                  <input type="text" class="form-control" name="deb_nmr" id="debiteur" placeholder="Debiteurnummer invoeren">
                </div>
                <div class="form-group">
                  <label for="pwd">Klantnaam:</label>
                  <input type="text" class="form-control" name="cost_name" id="costname" placeholder="Klantnaam invoeren">
                </div>
                <div class="form-group">
                  <label for="pwd">Aantal Pallets:</label>
                  <input type="text" class="form-control" name="numb_pal" id="numbpal" placeholder="Aantal pallets invoeren">
                </div>
                <div class="form-group">
                  <label for="pwd">Totaal gewicht:</label>
                  <input type="text" class="form-control" name="tot_weight" id="totweight" placeholder="Totaal gewicht invoeren + kg">
                </div>
                <div class="form-group">
                  <label for="pwd">PB nummers:</label>
                  <input type="text" class="form-control" name="pb_s"id="pbs" placeholder="Pakbonnummers invoeren + pb">
                </div>
                <input type="submit" value="submit">
              </form>
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-default"
                data-dismiss="modal">
              Close
              </button>
            </div>
          </div>
        </div>
      </div>
    </div>
  </nav>