- Messages
- 1,682
- Reaction score
- 32
- Points
- 48
If you have a website that has ads that just take to long to load, and prevents the user from seeing your website as quickly, then you're in the right topic! I'll show you how to load any object you want, in relation to other objects.
First, we got to understand that a browser reads the HTML from top to bottom, so if you have a script for the ad on the top of your page, the browser is going to have to finish reading that, then it goes onto the rest of the content.
What we are going to be doing here is placing the code at the bottom, and refering back to a <span> at the top of the page..so now onto the tutorial
as you can see I have a very, very basic webpage...(I don't even think it qualifies, but it works for what we are doing)
as you can see, I have gave the <span> and id, and refered to it at a script on the bottom of the page, after all the main content is loaded.
This will load the ad after 'Main Content' has been loaded.
First, we got to understand that a browser reads the HTML from top to bottom, so if you have a script for the ad on the top of your page, the browser is going to have to finish reading that, then it goes onto the rest of the content.
What we are going to be doing here is placing the code at the bottom, and refering back to a <span> at the top of the page..so now onto the tutorial
Code:
<html>
<body>
<span>Some ad here</span>
Main Content
</body>
</html>
Code:
<html>
<body>
<span="ad"></span>
Main Content
<script language="javascript">
document.getElementById("somethingloadlast").innerHTML = "Some Ad Here";
</script>
</body>
</html>
This will load the ad after 'Main Content' has been loaded.
Last edited: