如何在css下使用javascript的onclick函数[重复]

How to use onclick of javascript to close the popup menu of css by using close() function.

This is my php code....>

 `if(isset($_SESSION['MSG'])){
  echo '<div class="wrong"><div class="content"><span 
  class="close">&times;</span><p>' . $_SESSION['MSG'] .  '</p></div> 
  </div>';
  unset ($_SESSION['MSG']);
  session_destroy ();
  }`

And this javascript code..>

var span = document.getElementsByClassName("close")[0];
span.onclick = function() {
modal.style.display = "none";
}
window.onclick = function(event) {
if (event.target == modal) {
    modal.style.display = "none";
}
}
</div>