March 6, 200917 yr I'm generating an iframe with javascript iframe=document.createElement("iframe"); iframe.setAttribute("src","http://someaddress.co.uk/"); iframe.setAttribute("style","position: fixed; top: 0px; left: 0px; z-index: 99999;"); iframe.setAttribute("width","400"); iframe.setAttribute("frameborder","no"); iframe.setAttribute("height","100%"); iframe.setAttribute("id","myIframeId"); void(document.body.appendChild(iframe)); If there any way I can have a link inside this iframe that removes it from the page? Maybe something like this? <a href="java script:window.parent.document.getElementById('myIframeId').parentNode.removeChild(window.parent.document.getElementById('myIframeId'))">Close</a> Doesn't work? Thanks
March 6, 200917 yr Im not 100% on what you mean, do you mean you want the link inside the iframe to open in a new browser window??
March 6, 200917 yr Author Im not 100% on what you mean, do you mean you want the link inside the iframe to open in a new browser window?? No, my page loads up and the javascript is run that creates an iframe. In that iframe there is some information and a link that says "remove this iframe". When you click it the frame in which the link resides is removed leaving the page as it would have been if the initial javascript had not been run.
Create an account or sign in to comment