Не открывается модальное окно, ошибку не выдаёт, просто нет реакции при нажатии на кнопку
<!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>
<link href="css/style.css" type="text/css" rel="stylesheet" />
</head>
<body onload="fun3(),fun4(),fun5(),fun6()">
<div id ="lesson_6" class="lessons">
<div class="iframe"><iframe width="760" height="515" src="https://www.youtube.com/embed/R2Es_mbSva0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></div>
<button id="modalw">Open Modal</button>
<div id="myModal" class="modal">
<div class="modalContent">
<span class="close">×</span>
<p>Modal window</p>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="js.js"></script>
</body>
</html>
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";
}
}
Как исправить?