Показать сообщение отдельно
  #4 (permalink)  
Старый 15.03.2018, 21:52
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,072

Bomberman,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8">
  <title>Практика Javascript</title>
  <style type="text/css">
  .modal{
  display: none;
  position: fixed;
  z-index: 1;
  left: 0;
  top:0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.8);
}

.modalContent{
  background-color: #fefefe;
  margin: 15% auto;
  padding: 20px;
  border:1px solid #888;
  width: 80%;
  color: black;
  text-align: center;

}
.close{
  color:#aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
}
  </style>
</head>
<body>
<div id ="lesson_6" class="lessons">
       		<button id="modalw">Open Modal</button>
       		<div id="myModal" class="modal">
       			<div class="modalContent">
       				<span class="close">&times;</span>
       				<p>Modal window</p>
       			</div>
       		</div>

       	</div>





  <script>
  var modal = document.getElementById("myModal");
      btn = document.getElementById('modalw');
      span = document.getElementsByClassName("close")[0];

btn.onclick =  function () {
  modal.style.display = "block";
}





span.onclick = function () {
  modal.style.display = "none";
}

window.onclick = function (event) {
  if (event.target == modal) {
    modal.style.display = "none";
  }
}
</script>
</body>
</html>
Ответить с цитированием