In order to improve the speed of my search engine, I am implementing lazy loading by using numerous iframes to display various elements of the results. Within the JavaScript code that connects the element ID to the creation of the iframe, I have set the frameborder to "0". I am reaching out with this query to inquire if there is an alternative method to remove the frameborder, as the current approach does not seem to be effective. Below is the snippet of JavaScript code:
<script>
//does not delay the load event
function createIframe(){
var i = document.createElement("iframe");
var a = Math.random() + "";
var t = a * 10000000000000;
i.src = "http://harvix.com/images2.cgi?$query";
i.scrolling = "auto";
i.frameborder = "0";
i.width = "100%";
i.height = "400px";
document.getElementById("frame1").appendChild(i);
};
// Verify if the browser supports event handling
if (window.addEventListener)
window.addEventListener("load", createIframe, false);
else if (window.attachEvent)
window.attachEvent("onload", createIframe);
else window.onload = createIframe;
</script>
The JavaScript code pertains to the following element which is used for the placement of the iframe:
print"<div id=\"frame1\"></div>";
All of this is executed within a CGI perl document, hence the inclusion of the print statement.
-Dskrenta