Skip to content Skip to sidebar Skip to footer

How To Open Link In Popup Box?

I'd like to open this link as a popup box:

Solution 1:

Build your own popup box with an iframe element;

onclick you can change the src of the iframe to the one you want


document.getElementById('modalBtn').onclick = displayPopup;

functiondisplayPopup() {
  var popup = document.getElementById("popup");
  var frame = document.getElementById('popupFrame');
  frame.src = "https://www.bing.com";
  popup.style.display = "block";
}
#popup {
  width: 320px;
  height: 300px;
  margin: 0 auto;
  box-shadow: 1px1px1px1px black;
  display: none;
}
#popupiframe {
  width: 100%;
  height: 100%
}
<divid="popup"><iframeid="popupFrame"src=""></iframe></div><buttonid="modalBtn">Display Popup</button>

Solution 2:

Whoops.. misread your question

Re-answer:

Use jQuery.

$(document).ready(function (){
    $("#testButton").click(function() {$('#overlayContainer').show();});
});

Jsfiddle Demo

Post a Comment for "How To Open Link In Popup Box?"