This hack shows a side-box with a random list of recommended readings from Amazon.
It uses your Amazon Associate ID and a list of ASIN/ISBN. The user can go back and forth through the list. You can see it working on the bottom-right of this page.
- The parameters in oAMZ are pretty much self explanatory
- It actually uses my own Amazon Associate ID, you can tweak it by looking for immeleblogdes-20 and stephahamelim-20
Blogger Beta
Create a new HTML/JavaScript Page Element and give it a meaningful title such as "Recommended Reading". Then copy the code below:
<!-- Begin Amazon Readings Blogger Scriptlet -->
<a style="float:left" href="javascript:arzPrev()">< Previous</a>
<a style="float:right" href="javascript:arzNext()">Next ></a>
<center><iframe scrolling="no" width="120" frameborder="0" marginheight="0" name="fAmazon" height="172" marginwidth="0"></iframe></center>
<script type="text/javascript">
<!-- Begin Amazon Recommended Readings
var oAMZ = {
sLocale:"CA", // {US|CA}
bImage: "Large", // (Large|Small|None)
bPrice: "None", // (All|New|None)
sTextColor: "000000",
sLinkColor: "000000",
sBorderColor:"ffffff",
sBackgroundColor:"ffffff",
sWindow:"_blank",
asASIN:[
"078521965X", // Call to Action
"0072257024", // Google AdWords
"0470053852", // Google Analytics
"0785218971", // Waiting for your cat to bark
"0321344758", // Don't make me think
]
};
function arzSet(i){fAmazon.location.href=oAMZ.sURL+"&asins="+oAMZ.asASIN[oAMZ.iPos]}
function arzNext(i){oAMZ.iPos=oAMZ.iPos==oAMZ.asASIN.length-1?0:oAMZ.iPos+1;arzSet(i)}
function arzPrev(i){oAMZ.iPos=(!oAMZ.iPos?oAMZ.asASIN.length-1:oAMZ.iPos-1);arzSet(i)}
oAMZ.sURL="http://rcm"+(oAMZ.sLocale=="CA"?"-ca.amazon.ca/e/cm?t=immeleblogdes-20&o=15":".amazon.com/e/cm?t=stephahamelim-20&amp;amp;o=1")+(oAMZ.bPrice=="New"?"&nou=1":(oAMZ.bPrice=="None"?"&npa=1":""))+(oAMZ.bImage=="Large"?"&IS2=1&p=8":(oAMZ.bImage=="Small"?"&IS1=1&amp;amp;p=8":"&noImg=1&p=6"))+"&fc1="+oAMZ.sTextColor+"&lc1="+oAMZ.sLinkColor+"&bc1="+oAMZ.sBorderColor+"&bg1="+oAMZ.sBackgroundColor+"&f=ifr&l=as1<1="+oAMZ.sWindow;
oAMZ.iPos = Math.round(Math.random()*(oAMZ.asASIN.length-1));
arzSet(oAMZ.iPos);
// End Amazon Recommended Readings -->
</script>
Classic Blogger
This hack shows a side-box with a random list of recommended readings from Amazon.
It uses your Amazon Associate ID and a list of ASIN/ISBN. The user can go back and forth through the list. You can see it working on the bottom-right of this page.
- Change the sAmazonAssociateID to your own account
- Change the list of ASIN/ISBN in asAmazon.
- You might want to tweak the colors to your own side design where it says
"fAmazon.location.href=..." - fc1=99ddbb // text color
- lc1=99ddbb // link color
- bc1=223344 // border color
- bg1=223344 // background color
<!-- Begin .box #2 -->
<div class="box"><div class="box2"><div class="box3">
<h2 class="sidebar-title">Recommended Readings</h2>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td colspan="2" align="center">
<iframe name=fAmazon width="120" height="240" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe><br/>
</td></tr>
<tr><td> <input type="button" value="<<" onclick="azPrevious()"></td>
<td align="right"><input type="button" value=">>" onclick="azNext()"> </td>
</tr>
</table>
<script language="javascript">
var sAmazonAssociatesID = "immeleblogdes-20"; // Change this to your own Amazon Associate ID
var asAmazon = new Array(
"0735710627", // Change the list below to your own list of ASIN/ISBN
"1568303823",
"0131854615" // Make sure last entry doesn't end with a comma
);
var azPos = Math.round(Math.random()*(asAmazon.length-1));azSet();
function azSet(){fAmazon.location.href="http://rcm-ca.amazon.ca/e/cm"+"?t="+sAmazonAssociatesID+"&o=15&p=8&l=as1&asins="+asAmazon[azPos]+"&fc1=99ddbb&amp;amp;=1&lc1=99ddbb&bc1=223344<1=_blank&IS2=1&f=ifr&amp;amp;bg1=223344";}
function azNext(){azPos = azPos == asAmazon.length-1?0:azPos+1;azSet();}
function azPrevious(){azPos = !azPos?asAmazon.length-1:azPos-1;azSet();}
</script>
</div></div></div>
<!-- End .box #2 -->
- See my other Blogger hacks:
- Reverse, year based archive list
- Simultaneously publish Blogger to MSN Space
- Random quotes in sub-header