2016-02-17 60 views
1

美好的一天, 我有一個關於我的代碼在引導彈出窗口模式的問題,它很早關閉時,我點擊提交按鈕/(打印)按鈕。你會試圖告訴我調用彈出窗口模式的正確方法嗎? 請參閱下面的代碼。感謝Bootstrap popup模式關閉提交時提前?

<!DOCTYPE html> 
 
<html lang="en"> 
 
<head> 
 
    <title>Bootstrap Example</title> 
 
    <meta charset="utf-8"> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
 
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> 
 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> 
 
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> 
 
</head> 
 
<!-- Top content --> 
 
<div class="top-content"> 
 

 
    <div class="inner-bg"> 
 
    <div class="container"> 
 
     <div class="row"> 
 
     <div class="col-sm-8 col-sm-offset-2 text"> 
 
      <h1><strong>IT Request </strong> Form</h1> 
 
      <div class="description"> 
 

 
      </div> 
 
     </div> 
 
     </div> 
 
     <div class="row"> 
 
     <div class="col-sm-6 col-sm-offset-3 form-box"> 
 

 
      <div class="form-bottom"> 
 
      <form role="form" action="#myModal" method="post" class="login-form"> 
 
       <div class="form-group"> 
 
       <label class="sr-only">requestor</label> 
 
       <input type="text" name="itrf_requestor" placeholder="Requested By..." class="form-username form-control" id="itrf_requestor"> 
 
       </div> 
 

 
       <button type="submit" class="btn" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Print</button> 
 
      </form> 
 
      </div> 
 
     </div> 
 
     </div> 
 

 
    </div> 
 
    </div> 
 

 
</div> 
 

 

 
<!-- Javascript --> 
 
<script src="assets/js/jquery-1.11.1.min.js"></script> 
 
<script src="assets/bootstrap/js/bootstrap.min.js"></script> 
 
<script src="assets/js/jquery.backstretch.min.js"></script> 
 
<script src="assets/js/scripts.js"></script> 
 

 
<!--[if lt IE 10]> 
 
      <script src="assets/js/placeholder.js"></script> 
 
     <![endif]--> 
 

 
</body> 
 

 
</html> 
 

 
<div id="myModal" class="modal fade" role="dialog"> 
 
    <div class="modal-dialog"> 
 

 
    <!-- Modal content--> 
 
    <div class="modal-content"> 
 
     <div class="modal-header"> 
 
     <button type="button" class="close" data-dismiss="modal">&times;</button> 
 
     <h4 class="modal-title">Modal Header</h4> 
 
     </div> 
 
     <div class="modal-body"> 
 

 

 

 
     <form method="POST" action="form.php"> 
 
      <input type="text" name="form" value="ITREQUESTFORM-"> 
 
      <input type="text" name="itrf_requestor" value=""> 
 
      <p> 
 
      <input type="submit" alt="SUBMIT" name="Submit" value="PRINT" class="submit-text" /> 
 
     </form> 
 
     </div> 
 

 
    </div> 
 

 
    </div> 
 
</div>

回答

0

您所描述的模式按鈕類型爲幫助:) 「提交」,而應該是 「按鈕」

<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button> 

<!DOCTYPE html> 
 
<html lang="en"> 
 

 
<head> 
 
    <title>Bootstrap Example</title> 
 
    <meta charset="utf-8"> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
 
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> 
 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> 
 
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> 
 
    <script src="assets/js/jquery-1.11.1.min.js"></script> 
 
    <script src="assets/bootstrap/js/bootstrap.min.js"></script> 
 
    <script src="assets/js/jquery.backstretch.min.js"></script> 
 
    <script src="assets/js/scripts.js"></script> 
 
    <!--[if lt IE 10]> 
 
      <script src="assets/js/placeholder.js"></script> 
 
     <![endif]--> 
 
</head> 
 
<!-- Top content --> 
 
<div class="top-content"> 
 
    <div class="inner-bg"> 
 
    <div class="container"> 
 
     <div class="row"> 
 
     <div class="col-sm-8 col-sm-offset-2 text"> 
 
      <h1><strong>IT Request </strong> Form</h1> 
 
     </div> 
 
     </div> 
 
     <div class="row"> 
 
     <div class="col-sm-6 col-sm-offset-3 form-box"> 
 
      <div class="form-bottom"> 
 
      <form role="form" method="post" class="login-form"> 
 
       <div class="form-group"> 
 
       <label class="sr-only">requestor</label> 
 
       <input type="text" name="itrf_requestor" placeholder="Requested By..." class="form-username form-control" id="itrf_requestor"> 
 
       </div> 
 
       <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Print</button> 
 
      </form> 
 
      </div> 
 
     </div> 
 
     </div> 
 
     <div id="myModal" class="modal fade" role="dialog"> 
 
     <div class="modal-dialog"> 
 
      <div class="modal-content"> 
 
      <div class="modal-header"> 
 
       <button type="button" class="close" data-dismiss="modal">&times;</button> 
 
       <h4 class="modal-title">Modal Header</h4> 
 
      </div> 
 
      <div class="modal-body"> 
 
       <form method="POST" action="form.php"> 
 
       <input type="text" name="form" value="ITREQUESTFORM-"> 
 
       <input type="text" name="itrf_requestor" value=""> 
 
       <p> 
 
        <input type="submit" alt="SUBMIT" name="Submit" value="PRINT" class="submit-text" /> 
 
       </p> 
 
       </form> 
 
      </div> 
 
      </div> 
 
     </div> 
 
     </div> 
 
    </div> 
 
    </div> 
 
</div> 
 

 
</html>