Hi!
My page has a list of products. Clicking on one of these product images brings up a detailed information iframe popup with interactive photos and text. The information is stored in a MySQL database, accessed with PHP.
I've struggled for hours to find the best way to open and close this iframe. The below method works, but is slow. I'm wondering if there is a way to do this that will pop up the iframe with its content faster.
Parent Page Head:
function OpenFrame(ID)
{
newID = ID;
var makeframe=document.createElement("iframe");
makeframe.setAttribute("id", "PopIframe");
makeframe.setAttribute("class", "PopIframe");
makeframe.setAttribute("name", "PopIframe");
makeframe.setAttribute("frameborder", "0");
makeframe.setAttribute("src", "detailbox.php?ID=" + newID); // ID=Database record ID for item search
makeframe.setAttribute("scrolling", "no");
document.body.appendChild(makeframe);
}
function ClosePopup()
{
var ifr = parent.document.getElementById("PopIframe");
ifr.parentNode.removeChild(ifr);
}
In detailbox.php:
<a class="CloseLink" href="javascript:void(0);" onclick="window.parent.ClosePopup();">X</a>
The product has a series of styles, so once detailbox.php is open, the user may select other product information in the series by selecting an image, which recalls the page in the iframe with a different database ID get.
Currently, on my computer, with a good broadband connection, this takes about 3 seconds for a page to load in the iframe. I'm hoping there is some way to make it snappier.