Using iframe to insert variable content to your page. Tips and Tricks for Webmasters

Dynamic content with iframe


  • Click the link on the left, to change the contents



The iframe


  • Create the iframe, with an initial content ::

<iframe
name="NAME_OF_FRAME" id="NAME_OF_FRAME"
src="URL of content"
width="xxx" height="xxx"
scrolling="no"
frameborder="no">
</iframe>


Changing the content of iframe


  • Create a normal anchor :

<a href="URL of content"
title="text for link"
target="NAME_OF_FRAME">Link</a>



Style for the content


  • Create an html page, with this style :

html
{
margin:0px;
padding:0px;
overflow: auto;
border: none;
}

body
{
width: xxxpx;
height: xxxpx;

margin: 0px 0px 0px 20px;

overflow: auto;
}



Creating an Ads Rotator


  • Using this technique, Math.random and window.setTimeout, it's easy to create an Ads Rotator :
  • This iframe will reload its contents every 120 seconds



More Informations




 






One Day - One Label - One Wine



Add this gadget to Google