I am trying to use lazy loading to make my search engine faster which uses lots of iframes to display different aspects of the results. In the javascript that links the id of the element to the javascript that creates the iframe I have specified frameborder="0". I am asking this question because I want to know if there is another way to get rid of the frameborder because this does not appear to be working. Here is the JavaScript code:
<script>
//doesn't block 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);
};
// Check for browser support of event handling capability
if (window.addEventListener)
window.addEventListener("load", createIframe, false);
else if (window.attachEvent)
window.attachEvent("onload", createIframe);
else window.onload = createIframe;
</script>
This JavaScript corresponds to this element which is for the iframe placement:
print"<div id=\"frame1\"></div>";
This all runs in a CGI perl document, hence the print statement.
-Dskrenta
2 Answers 2
Just a little remark. Lots of I frame gives async requests and thus async display. In my opinion it will be better to use ajax calls and get control over the display.
Comments
CSS will do it easily, try this:
<style>iframe { border: none; }</style>
or
i.style = "border: none;"