【问题标题】:bootstrap popup modal not opening引导弹出模式未打开
【发布时间】:2017-04-30 14:01:04
【问题描述】:

制作了一个带有表单字段的引导弹出窗口。在 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>

【问题讨论】:

    标签: php twitter-bootstrap bootstrap-modal


    【解决方案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>

    【讨论】:

    • 行得通!但它也改变了我的数据表的整个布局?
    • 太棒了!快乐编码。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-23
    • 2019-02-25
    • 2015-08-29
    • 1970-01-01
    • 2022-06-14
    • 2015-02-16
    相关资源
    最近更新 更多