Friday, April 30, 2010

How to add image rotation with JavaScript

From this tutorial, you will be able to filter images through a single script. This is a handy script for not only web-development but also online marketing. By filtering affiliate ad’s through the script, you will be able to gain valuable insights on your readers interest and which ads are actually generating clicks and leads for you or vice versa.

adrotation

document_letter_upload_thumb14 Click here to see the demo

To add the image rotation:

1. From your Blogger dashboard, navigate to Layouts and then Edit HTML.

2. From Page Elements, select Add HTML/JavaScript and then add the following JavaScript below after modifying it with your images:

 

<script language='javascript'>
// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
<!--
i=0;
var ads = new Object();
var header='<CENTER><TABLE CELLPADDING=0 CELLSPACING=1 BORDER=0><TR><TD '
+ 'ALIGN=CENTER><FONT SIZE=2 FACE=Arial>';
ads[i++] = header


+'<A HREF="THE HEADER LINK" TARGET="_top">HEADER TITLE</A>'
+'</TD><TR></TR><TD><A HREF="THE IMAGE LINK" TARGET'
+'="_top"><CENTER><IMG SRC="THE LINK TO YOUR DESIRED IMAGE TO BE DISPLAYED"></CENTER>'
+'</A></TD></TR></TABLE></CENTER>';


ads.length = i;
dat = new Date();
dat = (dat.getTime()+"").charAt(8);
if (dat.length == 1)
ad_num = dat%ads.length;
else
ad_num = 0;
document.write(ads[ad_num]);
// –>
</script>

 

0128[6]You can add more images by simply adding the section code below right after the middle section code above.

 

ads[i++] = header +'&lt;a href=&quot;THE HEADER LINK&quot; target=&quot;_top&quot;&gt;HEADER TITLE&lt;/a&gt;' +'&lt;/td&gt;&lt;tr&gt;&lt;/tr&gt;&lt;td&gt;&lt;a href=&quot;THE IMAGE LINK&quot; +?=&quot;_top&quot; TARGET?=&quot;TARGET?&quot;&gt;&lt;/a&gt;&lt;center&gt;&lt;img src=&quot;THE LINK TO YOUR DESIRED IMAGE TO BE DISPLAYED&quot; /&gt;&lt;/center&gt;' +'&lt;/p&gt; &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;center&gt;&lt;/center&gt;';

 

 

 

 

 

4. You should preview your blog first to see if all codes have been implemented correctly. If so, save your template and you’re finished.

Source: http://simplythebest.net/scripts/

Labels: , , , ,

1 Comments:

Blogger Beben said...

hehhe the simply sob ;) .. xixixi

May 01, 2010  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home