javascript - How to open link in popup box? -
i'd open link popup box:
<a href="/upload/" onclick="window.open(this.href, 'windowname', 'width=500, height=350, left=24, top=24, scrollbars, resizable'); return false;">upload pic</a>
currently, opens in window, want bare popub box instead. how using js or jquery?
update: link inside form group , using iframe, suggested many here, causes form submit (not sure why though). non-iframe solution.
build own popup box iframe
element;
onclick
can change src
of iframe 1 want
document.getelementbyid('modalbtn').onclick = displaypopup; function displaypopup() { 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: 1px 1px 1px 1px black; display: none; } #popup iframe { width: 100%; height: 100% }
<div id="popup"> <iframe id="popupframe" src=""></iframe> </div> <button id="modalbtn">display popup</button>
Comments
Post a Comment