Page 1 of 1

remove duplicates

Posted: Sun Oct 14, 2012 6:39 pm
by Vegan

Code: Select all

var outlist = [];

function showads(number) {
	for (i=0; i<number; i++) {
		temp = '<iframe src="http://rcm.amazon.com/e/cm?lt1=_blank&bc1=000000&IS2=1&bg1=FFFFFF&fc1=000000&lc1=0000FF&t=cpa07-20&o=1&p=8&l=as4&m=amazon&f=ifr&ref=ss_til&asins=';
		temp += amazonads[Math.floor(Math.random()*amazonads.length)];
		temp += '" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe>';
		document.write(temp);
	}
}
what I am considering is a strategy to feed outlist one way or another so that it contains the number of ads intended and is free of duplication for a given invocation which may occur more than once depending on the document its used on

the main array is simply the Amazon ASINS code for the game ad being shown, the script simply pastes it all together