用html制作弹出窗口?

时间:2015-11-27 03:11:27

标签: html css

如何在图片中显示弹出窗口?

enter image description here

英语不是我的母语。在此之前

2 个答案:

答案 0 :(得分:2)

试试这个,你可以使用bootstrap JS Modal。http://www.w3schools.com/bootstrap/bootstrap_ref_js_modal.asp



<!DOCTYPE html>
<html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  <style>
  .modal-header, h4, .close {
      background-color: #5cb85c;
      color:white !important;
      text-align: center;
      font-size: 30px;
  }
  .modal-footer {
      background-color: #f9f9f9;
  }
  </style>
</head>
<body>

<div class="container">
  <h2>Modal Password Reset</h2>
  <!-- Trigger the modal with a button -->
  <a href="#" id="myBtn">Reset Password</a>

  <!-- Modal -->
  <div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">
    
      <!-- Modal content-->
      <div class="modal-content">
        
        <div class="modal-body" style="padding:40px 50px;">
          <form role="form">
            <div class="form-group">
              <label for="usrname">Enter Email Address</label>
              <input type="email" class="form-control" id="usrname" placeholder="Enter email">
            </div>
            
            
              <button type="submit" class="btn btn-success btn-block">Send</button>
<button class="btn btn-danger btn-block">Back</button>
          </form>

        
      </div>
      
    </div>
  </div> 
</div>
 
<script>
$(document).ready(function(){
    $("#myBtn").click(function(){
        $("#myModal").modal();
    });
});
</script>

</body>
</html>
&#13;
&#13;
&#13;

答案 1 :(得分:1)

使用jQuery ui dialog

&#13;
&#13;
<!doctype html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <title>jQuery UI Dialog - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">
  <script>
    $(function() {
      $("#dialog").dialog();
    });
  </script>
</head>

<body>

  <div id="dialog" title="Basic dialog">
    <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
  </div>


</body>

</html>
&#13;
&#13;
&#13;