Big problem whit my script, help

Discussion in 'JavaScript' started by perplera, Mar 29, 2010.

  1. #1
    Good staff.
    I have a doubt that I would like to help me if possible.
    I have a java code that I put the 3 banners run but I can not put them to rotate horizontally, I can only vertically.

    
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Prototipo OK Franchising</title>
    <script type="text/javascript" src="banners.min.js"></script>
    </head>
    <body>
    	<script type="text/javascript">
    		show_banners('top');
    	</script>
        
        <br>
    	
    	<script type="text/javascript">
    		show_banners('top');
    	</script>
        
        <br>
        
    	<script type="text/javascript">
    		show_banners('top');
    	</script>
        
        <br>
        
    	<script type="text/javascript">
    		show_banners('top');
    	</script>
        
    </body>
    </html>
    
    Code (markup):


    Someone help me?
     
    perplera, Mar 29, 2010 IP
  2. s_ruben

    s_ruben Active Member

    Messages:
    735
    Likes Received:
    26
    Best Answers:
    1
    Trophy Points:
    78
    #2
    You mean that every code:

    <script type="text/javascript">
    show_banners('top');
    </script>

    puts 3 vertically banners? If it is so, white here the code of the file banners.min.js.
     
    s_ruben, Mar 29, 2010 IP
  3. perplera

    perplera Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Ok I'm all over the code here

    banners.js
    
    var settings = {
    	
    	'force_size':			1,         		// 	if set to 1 all banners will be resized to the width and height in the next to settings
    	'img_width':			80,			//	width to resize all banners to, only takes effect if above is 1
    	'img_height':			80, 			// 	height to resize all banners to, only takes effect if above is 1
    	
    	'refresh_time':			6000,			//	the seconds between refreshs of the banners - use 0 to disable
    	'refresh_max':			100,				//	maximum number of refreshs on each page load
    	
    	'duplicate_banners':	0,				//	keep as 0 to make sure the same banner won't show on the same page. will only take effect
    											//  if show_banners(); is used more than once. You must make sure you have enough banners to fill
    											//  all the slots else the browser may freeze or give a stack overflow error
    	
    	'location_prefix': 		'adLocation-',	//	The prefix of the IDs of the <div> which wraps the banners - this div is generated dynamically.
    											//  a number will be added on the end of this string. adLocation- was used by default before version 1.4.x
    											
    	'location_class':		'swb',			//  A class to add to all of the <div>s which wrap the banners, ideal to use for styling banners - use .swb img in your CSS	
    	
    	'window': 				'_self',		//	Window to open links in, _self = current, _blank = new. Use _top if in a frame!		
    	
    	'default_ad_loc':		'default'		//	The default adLocation. This is assigned to any banners not given an adLocation in the below banner list
    											//  There is no real reason to need to change this
    }
    
    
    /**
    		Banners
    **/
    // banner list syntax: new banner(website_name, website_url, banner_url, show_until_date, adlocation),  DATE FORMAT: dd/mm/yyyy
    // if you're not using adlocations just leave it empty like '' as in the last example here
    // to make sure a banner is always rotating, just set the date far into the future, i.e. year 3000
    
    var banners = [
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/49.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/48.jpg',		'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/47.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/46.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/45.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/44.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/43.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/42.jpg', 	'30/04/2019',	'top'),
    new banner('Dreamhost',				'http://www.dreamhost.com/r.cgi?259541',	'images/41.jpg',		'30/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/40.jpg', 	'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/39.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/38.jpg',		'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/37.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/36.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/35.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/34.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/33.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/32.jpg', 	'30/04/2019',	'top'),
    new banner('Dreamhost',				'http://www.dreamhost.com/r.cgi?259541',	'images/31.jpg',		'30/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/30.jpg', 	'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/29.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/28.jpg',		'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/27.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/26.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/25.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/24.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/23.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/22.jpg', 	'30/04/2019',	'top'),
    new banner('Dreamhost',				'http://www.dreamhost.com/r.cgi?259541',	'images/21.jpg',		'30/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/20.jpg', 	'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/19.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/18.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/17.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/16.jpg',		'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/15.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/14.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/13.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/12.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/11.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/10.jpg', 	'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/9.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/8.jpg',		'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/7.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/6.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/5.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/4.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/3.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/2.jpg', 	'30/04/2019',	'top'),
    new banner('Dreamhost',				'http://www.dreamhost.com/r.cgi?259541',	'images/1.jpg',		'30/04/2019',	'top')
    ]
    
    //         				There is no need to edit below here
    ///////////////////////////////////////////////////////////////////////////////////
    
    /*****
    "global" vars
    *****/
    var used				= 0;
    var location_counter	= 0;
    var refresh_counter 	= 1;
    var map 				= new Array();
    
    
    /*************
    	function banner()
    	creates a banner object
    *************/
    function banner(name, url, image, date, loc)
    {
    	this.name	= name;
    	this.url	= url;
    	this.image	= image;
    	this.date	= date;
    	this.active = 1;
    	this.oid = 0;
    	
    	// if no adlocation is given use the default a adlocation setting
    	// this is used if adlocations aren't being used or using pre-1.4.x code
    	if(loc != '')
    	{
    		this.loc = loc;
    	}
    	else
    	{
    		this.loc = settings.default_ad_loc;
    	}
    }
    
    
    /*************
    	function show_banners()
    	writes banner <div> HTML and maps ad locations to <div> ID tags
    *************/
    function show_banners(banner_location)
    {
    	// increase the counter ready for further calls
    	location_counter = location_counter + 1;
    
    	// this part maps the adlocation name supplied by the user to the adlocation
    	// ID used by the script
    	if(banner_location != '' && banner_location != undefined)
    	{
    		map[location_counter] = banner_location;
    	}
    	else
    	{
    		map[location_counter] = settings.default_ad_loc;
    	}
    
    	// writes banner html
    	var html = '<div id="' + settings.location_prefix + location_counter + '" class="' + settings.location_class + '"></div>';
    	document.write(html);
    	// calls the display banners script to fill this ad location
    	display_banners(location_counter);
    	
    }
    
    
    
    /*************
    	function display_banners()
    	displays banners for a given location number
    *************/
    function display_banners(location)
    {
    	// used in this function to hold tempoary copy of banners array
    	var location_banners	= new Array();
    	
    	// if no location is given, do nothing
    	if(location == '' || !location || location < 0)
    	{
    		return;
    	}
    	
    	// get total banners
    	var am	= banners.length;
    	
    	// all banners have been displayed in this pass and the user doesnt
    	// want to have duplicate banners showing
    	if((am == used) && settings.duplicate_banners == 0) {
    		return;
    	}
    
    	// new for 1.4.x, this takes the list of banners and creates a tempoary list
    	// with only the banners for the current adlocation in
    	for(i = 0; i < (banners.length); i++)
    	{
    		banners[i].oid = i;
    		if((banners[i].loc == map[location]) && (banners[i].active == 1))
    		{
    			location_banners.push(banners[i]);
    		}
    	}
    
    	// same as 1.2.x - finds the banner randomly
    	var rand	= Math.floor(Math.random()*location_banners.length);	
    	var bn 		= location_banners[rand];
    	
    	// creates html
    	var image_size 	= (settings.force_size == 1) ? ' width="' + settings.img_width + '" height="' + settings.img_height + '"' : '';
    	var html 		= '<a href="' + bn.url + '" title="' + bn.name + '" target="' + settings.window + '"><img border="0" src="' + bn.image + '"' + image_size + ' alt="' + bn.name + '" /></a>';
    	
    	// calculates the date from inputted string, expected formate is DD/MM/YYYY
    	var now		= new Date(); 
    	var input	= bn.date;
    	input		= input.split('/', 3);
    	
    	// creates a date object with info
    	var end_date	= new Date();
    	end_date.setFullYear(parseInt(input[2]), parseInt(input[1]) - 1, parseInt(input[0]));
    	
    	// compares curent date with banner end date
    	if((now < end_date) && bn.active == 1) 
    	{
    		// attempt to find adlocation div
    		var location_element = document.getElementById(settings.location_prefix + location);
    		
    		// couldn't find it, if this message shows there is a problem with show_banners
    		if(location_element == null)
    		{
    			alert('spyka Webmaster banner rotator\nError: adLocation doesn\'t exist!');
    		}
    		// output banner HTML
    		else
    		{
    			location_element.innerHTML = html;
    			
    			// if the user doesn't want the same banner to show again deactive it and increase
    			// the users banners counter
    			if(settings.duplicate_banners == 0)
    			{
    				banners[bn.oid].active = 0;
    				used++;
    			}
    			return;
    		}
    	}
    	else
    	{
    		// inactive banner, find another
    		// if no banners fit this adlocation you'll have an endless loop !
    		display_banners(location);
    	}
    	return;
    }
    
    
    
    /*************
    	function refresh_banners()
    	resets counters and active settings
    *************/
    function refresh_banners()
    {
    	if((refresh_counter == settings.refresh_max) || settings.refresh_time < 1)
    	{
    		clearInterval(banner_refresh);  
    	}
    	used = 0;
    	for(j = 0; j < (banners.length); j++)
    	{
    		banners[j].active = 1;
    	}
    
    	for(j = 1; j < (location_counter+1); j++)
    	{
    		display_banners(j);
    	}
    	refresh_counter++;
    }
    
    
    
    // set timeout
    var banner_refresh = window.setInterval(refresh_banners, settings.refresh_time);
    
    Code (markup):

    banners.min.js
    
    var settings = {
    	
    	'force_size':			1,         		// 	if set to 1 all banners will be resized to the width and height in the next to settings
    	'img_width':			80,			//	width to resize all banners to, only takes effect if above is 1
    	'img_height':			80, 			// 	height to resize all banners to, only takes effect if above is 1
    	
    	'refresh_time':			6000,			//	the seconds between refreshs of the banners - use 0 to disable
    	'refresh_max':			100,				//	maximum number of refreshs on each page load
    	
    	'duplicate_banners':	0,				//	keep as 0 to make sure the same banner won't show on the same page. will only take effect
    											//  if show_banners(); is used more than once. You must make sure you have enough banners to fill
    											//  all the slots else the browser may freeze or give a stack overflow error
    	
    	'location_prefix': 		'adLocation-',	//	The prefix of the IDs of the <div> which wraps the banners - this div is generated dynamically.
    											//  a number will be added on the end of this string. adLocation- was used by default before version 1.4.x
    											
    	'location_class':		'swb',			//  A class to add to all of the <div>s which wrap the banners, ideal to use for styling banners - use .swb img in your CSS	
    	
    	'window': 				'_self',		//	Window to open links in, _self = current, _blank = new. Use _top if in a frame!		
    	
    	'default_ad_loc':		'default'		//	The default adLocation. This is assigned to any banners not given an adLocation in the below banner list
    											//  There is no real reason to need to change this
    }
    
    
    /**
    		Banners
    **/
    // banner list syntax: new banner(website_name, website_url, banner_url, show_until_date, adlocation),  DATE FORMAT: dd/mm/yyyy
    // if you're not using adlocations just leave it empty like '' as in the last example here
    // to make sure a banner is always rotating, just set the date far into the future, i.e. year 3000
    
    var banners = [
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/49.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/48.jpg',		'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/47.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/46.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/45.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/44.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/43.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/42.jpg', 	'30/04/2019',	'top'),
    new banner('Dreamhost',				'http://www.dreamhost.com/r.cgi?259541',	'images/41.jpg',		'30/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/40.jpg', 	'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/39.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/38.jpg',		'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/37.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/36.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/35.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/34.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/33.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/32.jpg', 	'30/04/2019',	'top'),
    new banner('Dreamhost',				'http://www.dreamhost.com/r.cgi?259541',	'images/31.jpg',		'30/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/30.jpg', 	'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/29.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/28.jpg',		'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/27.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/26.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/25.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/24.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/23.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/22.jpg', 	'30/04/2019',	'top'),
    new banner('Dreamhost',				'http://www.dreamhost.com/r.cgi?259541',	'images/21.jpg',		'30/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/20.jpg', 	'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/19.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/18.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/17.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/16.jpg',		'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/15.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/14.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/13.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/12.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/11.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/10.jpg', 	'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/9.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/8.jpg',		'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/7.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/6.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/5.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/4.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/3.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/2.jpg', 	'30/04/2019',	'top'),
    new banner('Dreamhost',				'http://www.dreamhost.com/r.cgi?259541',	'images/1.jpg',		'30/04/2019',	'top')
    ]
    
    //         				There is no need to edit below here
    ///////////////////////////////////////////////////////////////////////////////////
    var used=0;var location_counter=0;var refresh_counter=1;var map=new Array();function banner(a,b,c,d,e){this.name=a;this.url=b;this.image=c;this.date=d;this.active=1;this.oid=0;if(e!=''){this.loc=e}else{this.loc=settings.default_ad_loc}}function show_banners(a){location_counter=location_counter+1;if(a!=''&&a!=undefined){map[location_counter]=a}else{map[location_counter]=settings.default_ad_loc}var b='<div id="'+settings.location_prefix+location_counter+'" class="'+settings.location_class+'"></div>';document.write(b);display_banners(location_counter)}function display_banners(a){var b=new Array();if(a==''||!a||a<0){return}var c=banners.length;if((c==used)&&settings.duplicate_banners==0){return}for(i=0;i<(banners.length);i++){banners[i].oid=i;if((banners[i].loc==map[a])&&(banners[i].active==1)){b.push(banners[i])}}var d=Math.floor(Math.random()*b.length);var e=b[d];var f=(settings.force_size==1)?' width="'+settings.img_width+'" height="'+settings.img_height+'"':'';var g='<a href="'+e.url+'" title="'+e.name+'" target="'+settings.window+'"><img border="0" src="'+e.image+'"'+f+' alt="'+e.name+'" /></a>';var h=new Date();var j=e.date;j=j.split('/',3);var k=new Date();k.setFullYear(parseInt(j[2]),parseInt(j[1])-1,parseInt(j[0]));if((h<k)&&e.active==1){var l=document.getElementById(settings.location_prefix+a);if(l==null){alert('spyka Webmaster banner rotator\nError: adLocation doesn\'t exist!')}else{l.innerHTML=g;if(settings.duplicate_banners==0){banners[e.oid].active=0;used++}return}}else{display_banners(a)}return}function refresh_banners(){if((refresh_counter==settings.refresh_max)||settings.refresh_time<1){clearInterval(banner_refresh)}used=0;for(j=0;j<(banners.length);j++){banners[j].active=1}for(j=1;j<(location_counter+1);j++){display_banners(j)}refresh_counter++}var banner_refresh=window.setInterval(refresh_banners,settings.refresh_time);
    
    
    Code (markup):


    index.html
    
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Prototipo OK Franchising</title>
    <script type="text/javascript" src="banners.min.js"></script>
    </head>
    <body>
    
       <br>
    
    	<script type="text/javascript">
    		show_banners('top');
    	</script>
        
        <br>
    	
    	<script type="text/javascript">
    		show_banners('top');
    	</script>
           
        <br>
        
    	<script type="text/javascript">
    		show_banners('top');
    	</script>
        
    </body>
    </html>
    
    
    Then just a folder of images
    
    
    Code (markup):
     
    perplera, Mar 30, 2010 IP
  4. s_ruben

    s_ruben Active Member

    Messages:
    735
    Likes Received:
    26
    Best Answers:
    1
    Trophy Points:
    78
    #4
    If I understood correctly what your want, so replace index.html to this:

    
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Prototipo OK Franchising</title>
    <script type="text/javascript" src="banners.min.js"></script>
    <style>
    .banners{
      float: left;
      margin-right: 10px;
    }
    
    
    </style>
    </head>
    <body>
    
        <div class="banners">
            <script type="text/javascript">
    		    show_banners('top');
    	    </script>
        </div>
    
        <div class="banners">
            <script type="text/javascript">
    		    show_banners('top');
    	    </script>
        </div>
    
        <div class="banners">
            <script type="text/javascript">
    		    show_banners('top');
    	    </script>
        </div>
    
    </body>
    </html>
    
    Code (markup):
    If it is not what you want, pls write in details.
     
    s_ruben, Mar 30, 2010 IP
  5. perplera

    perplera Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    That's right.
    You are the man.
    After seeing your code I noticed that I'm a turnip and missed a simple thing.
    Thanks, looks good
     
    perplera, Mar 30, 2010 IP
  6. perplera

    perplera Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    OK, but now another problem arises as to put another line below?
     
    perplera, Mar 30, 2010 IP
  7. s_ruben

    s_ruben Active Member

    Messages:
    735
    Likes Received:
    26
    Best Answers:
    1
    Trophy Points:
    78
    #7
    Do it like this:

    
    <div style="clear: both">
        <script type="text/javascript">
             show_banners('top');
        </script>
    </div>
    
    Code (markup):
    But it will be better to do using css.
     
    s_ruben, Mar 30, 2010 IP
  8. perplera

    perplera Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I tried to apply this script in a module adapted for Joomla but in reality was not as it should be.
    Will can give me a hand??

    banners.min.js
    
    var settings = {
    	
    	'force_size':			1,         		// 	if set to 1 all banners will be resized to the width and height in the next to settings
    	'img_width':			80,			//	width to resize all banners to, only takes effect if above is 1
    	'img_height':			80, 			// 	height to resize all banners to, only takes effect if above is 1
    	
    	'refresh_time':			15000,			//	the seconds between refreshs of the banners - use 0 to disable
    	'refresh_max':			100,				//	maximum number of refreshs on each page load
    	
    	'duplicate_banners':	0,				//	keep as 0 to make sure the same banner won't show on the same page. will only take effect
    											//  if show_banners(); is used more than once. You must make sure you have enough banners to fill
    											//  all the slots else the browser may freeze or give a stack overflow error
    	
    	'location_prefix': 		'adLocation-',	//	The prefix of the IDs of the <div> which wraps the banners - this div is generated dynamically.
    											//  a number will be added on the end of this string. adLocation- was used by default before version 1.4.x
    											
    	'location_class':		'swb',			//  A class to add to all of the <div>s which wrap the banners, ideal to use for styling banners - use .swb img in your CSS	
    	
    	'window': 				'_self',		//	Window to open links in, _self = current, _blank = new. Use _top if in a frame!		
    	
    	'default_ad_loc':		'default'		//	The default adLocation. This is assigned to any banners not given an adLocation in the below banner list
    											//  There is no real reason to need to change this
    }
    
    /**
    		Banners
    **/
    // banner list syntax: new banner(website_name, website_url, banner_url, show_until_date, adlocation),  DATE FORMAT: dd/mm/yyyy
    // if you're not using adlocations just leave it empty like '' as in the last example here
    // to make sure a banner is always rotating, just set the date far into the future, i.e. year 3000
    
    var banners = [
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/49.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/48.jpg',		'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/47.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/46.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/45.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/44.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/43.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/42.jpg', 	'30/04/2019',	'top'),
    new banner('Dreamhost',				'http://www.dreamhost.com/r.cgi?259541',	'images/clientes/41.jpg',		'30/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/40.jpg', 	'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/39.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/38.jpg',		'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/37.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/36.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/35.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/34.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/33.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/32.jpg', 	'30/04/2019',	'top'),
    new banner('Dreamhost',				'http://www.dreamhost.com/r.cgi?259541',	'images/clientes/31.jpg',		'30/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/30.jpg', 	'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/29.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/28.jpg',		'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/27.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/26.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/25.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/24.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/23.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/22.jpg', 	'30/04/2019',	'top'),
    new banner('Dreamhost',				'http://www.dreamhost.com/r.cgi?259541',	'images/clientes/21.jpg',		'30/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/20.jpg', 	'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/19.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/18.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/17.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/16.jpg',		'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/15.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/14.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/13.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/12.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/11.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/10.jpg', 	'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/9.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/8.jpg',		'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/7.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/6.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/5.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/4.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/3.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/2.jpg', 	'30/04/2019',	'top'),
    new banner('Dreamhost',				'http://www.dreamhost.com/r.cgi?259541',	'images/clientes/1.jpg',		'30/04/2019',	'top')
    ]
    
    //         				There is no need to edit below here
    ///////////////////////////////////////////////////////////////////////////////////
    var used=0;var location_counter=0;var refresh_counter=1;var map=new Array();function banner(a,b,c,d,e){this.name=a;this.url=b;this.image=c;this.date=d;this.active=1;this.oid=0;if(e!=''){this.loc=e}else{this.loc=settings.default_ad_loc}}function show_banners(a){location_counter=location_counter+1;if(a!=''&&a!=undefined){map[location_counter]=a}else{map[location_counter]=settings.default_ad_loc}var b='<div id="'+settings.location_prefix+location_counter+'" class="'+settings.location_class+'"></div>';document.write(b);display_banners(location_counter)}function display_banners(a){var b=new Array();if(a==''||!a||a<0){return}var c=banners.length;if((c==used)&&settings.duplicate_banners==0){return}for(i=0;i<(banners.length);i++){banners[i].oid=i;if((banners[i].loc==map[a])&&(banners[i].active==1)){b.push(banners[i])}}var d=Math.floor(Math.random()*b.length);var e=b[d];var f=(settings.force_size==1)?' width="'+settings.img_width+'" height="'+settings.img_height+'"':'';var g='<a href="'+e.url+'" title="'+e.name+'" target="'+settings.window+'"><img border="0" src="'+e.image+'"'+f+' alt="'+e.name+'" /></a>';var h=new Date();var j=e.date;j=j.split('/',3);var k=new Date();k.setFullYear(parseInt(j[2]),parseInt(j[1])-1,parseInt(j[0]));if((h<k)&&e.active==1){var l=document.getElementById(settings.location_prefix+a);if(l==null){alert('spyka Webmaster banner rotator\nError: adLocation doesn\'t exist!')}else{l.innerHTML=g;if(settings.duplicate_banners==0){banners[e.oid].active=0;used++}return}}else{display_banners(a)}return}function refresh_banners(){if((refresh_counter==settings.refresh_max)||settings.refresh_time<1){clearInterval(banner_refresh)}used=0;for(j=0;j<(banners.length);j++){banners[j].active=1}for(j=1;j<(location_counter+1);j++){display_banners(j)}refresh_counter++}var banner_refresh=window.setInterval(refresh_banners,settings.refresh_time);
    
    Code (markup):
    banners.js
    
    var settings = {
    	
    	'force_size':			1,         		// 	if set to 1 all banners will be resized to the width and height in the next to settings
    	'img_width':			80,			//	width to resize all banners to, only takes effect if above is 1
    	'img_height':			80, 			// 	height to resize all banners to, only takes effect if above is 1
    	
    	'refresh_time':			15000,			//	the seconds between refreshs of the banners - use 0 to disable
    	'refresh_max':			100,				//	maximum number of refreshs on each page load
    	
    	'duplicate_banners':	0,				//	keep as 0 to make sure the same banner won't show on the same page. will only take effect
    											//  if show_banners(); is used more than once. You must make sure you have enough banners to fill
    											//  all the slots else the browser may freeze or give a stack overflow error
    	
    	'location_prefix': 		'adLocation-',	//	The prefix of the IDs of the <div> which wraps the banners - this div is generated dynamically.
    											//  a number will be added on the end of this string. adLocation- was used by default before version 1.4.x
    											
    	'location_class':		'swb',			//  A class to add to all of the <div>s which wrap the banners, ideal to use for styling banners - use .swb img in your CSS	
    	
    	'window': 				'_self',		//	Window to open links in, _self = current, _blank = new. Use _top if in a frame!		
    	
    	'default_ad_loc':		'default'		//	The default adLocation. This is assigned to any banners not given an adLocation in the below banner list
    											//  There is no real reason to need to change this
    }
    
    
    /**
    		Banners
    **/
    // banner list syntax: new banner(website_name, website_url, banner_url, show_until_date, adlocation),  DATE FORMAT: dd/mm/yyyy
    // if you're not using adlocations just leave it empty like '' as in the last example here
    // to make sure a banner is always rotating, just set the date far into the future, i.e. year 3000
    
    var banners = [
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/49.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/48.jpg',		'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/47.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/46.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/45.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/44.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/43.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/42.jpg', 	'30/04/2019',	'top'),
    new banner('Dreamhost',				'http://www.dreamhost.com/r.cgi?259541',	'images/clientes/41.jpg',		'30/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/40.jpg', 	'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/39.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/38.jpg',		'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/37.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/36.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/35.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/34.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/33.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/32.jpg', 	'30/04/2019',	'top'),
    new banner('Dreamhost',				'http://www.dreamhost.com/r.cgi?259541',	'images/clientes/31.jpg',		'30/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/30.jpg', 	'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/29.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/28.jpg',		'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/27.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/26.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/25.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/24.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/23.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/22.jpg', 	'30/04/2019',	'top'),
    new banner('Dreamhost',				'http://www.dreamhost.com/r.cgi?259541',	'images/clientes/21.jpg',		'30/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/20.jpg', 	'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/19.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/18.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/17.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/16.jpg',		'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/15.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/14.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/13.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/12.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/11.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/10.jpg', 	'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/9.jpg',		'30/04/2019',	'top'),
    new banner('Flashden', 				'http://www.flashden.net/?ref=spykawg', 	'images/clientes/8.jpg',		'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/7.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/6.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/5.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/4.jpg', 	'30/04/2019',	'top'),
    new banner('ThemeForest', 			'http://www.themeforest.net/?ref=spykawg', 	'images/clientes/3.jpg', 	'10/04/2019',	'top'),
    new banner('GraphicRiver', 			'http://www.graphicriver.net/?ref=spykawg', 'images/clientes/2.jpg', 	'30/04/2019',	'top'),
    new banner('Dreamhost',				'http://www.dreamhost.com/r.cgi?259541',	'images/clientes/1.jpg',		'30/04/2019',	'top')
    ]
    
    //         				There is no need to edit below here
    ///////////////////////////////////////////////////////////////////////////////////
    
    /*****
    "global" vars
    *****/
    var used				= 0;
    var location_counter	= 0;
    var refresh_counter 	= 1;
    var map 				= new Array();
    
    
    /*************
    	function banner()
    	creates a banner object
    *************/
    function banner(name, url, image, date, loc)
    {
    	this.name	= name;
    	this.url	= url;
    	this.image	= image;
    	this.date	= date;
    	this.active = 1;
    	this.oid = 0;
    	
    	// if no adlocation is given use the default a adlocation setting
    	// this is used if adlocations aren't being used or using pre-1.4.x code
    	if(loc != '')
    	{
    		this.loc = loc;
    	}
    	else
    	{
    		this.loc = settings.default_ad_loc;
    	}
    }
    
    /*************
    	function show_banners()
    	writes banner <div> HTML and maps ad locations to <div> ID tags
    *************/
    function show_banners(banner_location)
    {
    	// increase the counter ready for further calls
    	location_counter = location_counter + 1;
    
    	// this part maps the adlocation name supplied by the user to the adlocation
    	// ID used by the script
    	if(banner_location != '' && banner_location != undefined)
    	{
    		map[location_counter] = banner_location;
    	}
    	else
    	{
    		map[location_counter] = settings.default_ad_loc;
    	}
    
    	// writes banner html
    	var html = '<div id="' + settings.location_prefix + location_counter + '" class="' + settings.location_class + '"></div>';
    	document.write(html);
    	// calls the display banners script to fill this ad location
    	display_banners(location_counter);
    	
    }
    
    /*************
    	function display_banners()
    	displays banners for a given location number
    *************/
    function display_banners(location)
    {
    	// used in this function to hold tempoary copy of banners array
    	var location_banners	= new Array();
    	
    	// if no location is given, do nothing
    	if(location == '' || !location || location < 0)
    	{
    		return;
    	}
    	
    	// get total banners
    	var am	= banners.length;
    	
    	// all banners have been displayed in this pass and the user doesnt
    	// want to have duplicate banners showing
    	if((am == used) && settings.duplicate_banners == 0) {
    		return;
    	}
    
    	// new for 1.4.x, this takes the list of banners and creates a tempoary list
    	// with only the banners for the current adlocation in
    	for(i = 0; i < (banners.length); i++)
    	{
    		banners[i].oid = i;
    		if((banners[i].loc == map[location]) && (banners[i].active == 1))
    		{
    			location_banners.push(banners[i]);
    		}
    	}
    
    	// same as 1.2.x - finds the banner randomly
    	var rand	= Math.floor(Math.random()*location_banners.length);	
    	var bn 		= location_banners[rand];
    	
    	// creates html
    	var image_size 	= (settings.force_size == 1) ? ' width="' + settings.img_width + '" height="' + settings.img_height + '"' : '';
    	var html 		= '<a href="' + bn.url + '" title="' + bn.name + '" target="' + settings.window + '"><img border="0" src="' + bn.image + '"' + image_size + ' alt="' + bn.name + '" /></a>';
    	
    	// calculates the date from inputted string, expected formate is DD/MM/YYYY
    	var now		= new Date(); 
    	var input	= bn.date;
    	input		= input.split('/', 3);
    	
    	// creates a date object with info
    	var end_date	= new Date();
    	end_date.setFullYear(parseInt(input[2]), parseInt(input[1]) - 1, parseInt(input[0]));
    	
    	// compares curent date with banner end date
    	if((now < end_date) && bn.active == 1) 
    	{
    		// attempt to find adlocation div
    		var location_element = document.getElementById(settings.location_prefix + location);
    		
    		// couldn't find it, if this message shows there is a problem with show_banners
    		if(location_element == null)
    		{
    			alert('spyka Webmaster banner rotator\nError: adLocation doesn\'t exist!');
    		}
    		// output banner HTML
    		else
    		{
    			location_element.innerHTML = html;
    			
    			// if the user doesn't want the same banner to show again deactive it and increase
    			// the users banners counter
    			if(settings.duplicate_banners == 0)
    			{
    				banners[bn.oid].active = 0;
    				used++;
    			}
    			return;
    		}
    	}
    	else
    	{
    		// inactive banner, find another
    		// if no banners fit this adlocation you'll have an endless loop !
    		display_banners(location);
    	}
    	return;
    }
    
    /*************
    	function refresh_banners()
    	resets counters and active settings
    *************/
    function refresh_banners()
    {
    	if((refresh_counter == settings.refresh_max) || settings.refresh_time < 1)
    	{
    		clearInterval(banner_refresh);  
    	}
    	used = 0;
    	for(j = 0; j < (banners.length); j++)
    	{
    		banners[j].active = 1;
    	}
    
    	for(j = 1; j < (location_counter+1); j++)
    	{
    		display_banners(j);
    	}
    	refresh_counter++;
    }
    
    // set timeout
    var banner_refresh = window.setInterval(refresh_banners, settings.refresh_time);
    
    Code (markup):
     
    perplera, Mar 31, 2010 IP
  9. perplera

    perplera Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    index.htm
    
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Prototipo OK Franchising</title>
    <script type="text/javascript" src="banners.min.js"></script>
    <style>
    .banners{
      float: left;
      margin-right: 10px;
    }
    
    </style>
    </head>
    <body>
    
        <div class="banners">
            <script type="text/javascript">
    		    show_banners('top');
    	    </script>
        </div>
    
        <div class="banners">
            <script type="text/javascript">
    		    show_banners('top');
    	    </script>
        </div>
    
        <div class="banners">
            <script type="text/javascript">
    		    show_banners('top');
    	    </script>
        </div>
    
        <div class="banners">
            <script type="text/javascript">
    		    show_banners('top');
    	    </script>
        </div>
    
        <div class="banners">
            <script type="text/javascript">
    		    show_banners('top');
    	    </script>
        </div>
    
        <div style="clear: both">
        <script type="text/javascript">
             show_banners('top');
    
    
        <div class="banners">
            <script type="text/javascript">
    		    show_banners('top');
    	    </script>
        </div>
    
        <div class="banners">
            <script type="text/javascript">
    		    show_banners('top');
    	    </script>
        </div>
    
        <div class="banners">
            <script type="text/javascript">
    		    show_banners('top');
    	    </script>
        </div>
    
        <div class="banners">
            <script type="text/javascript">
    		    show_banners('top');
    	    </script>
        </div>
    
        <div class="banners">
            <script type="text/javascript">
    		    show_banners('top');
    	    </script>
        </div>
    
        <div class="banners">
            <script type="text/javascript">
    		    show_banners('top');
    	    </script>
        </div>
    
        </script></div>
    
        <div style="clear: both">
        <script type="text/javascript">
             show_banners('top');
    
    
        <div class="banners">
            <script type="text/javascript">
    		    show_banners('top');
    	    </script>
        </div>
    
        <div class="banners">
            <script type="text/javascript">
    		    show_banners('top');
    	    </script>
        </div>
    
        <div class="banners">
            <script type="text/javascript">
    		    show_banners('top');
    	    </script>
        </div>
    
        <div class="banners">
            <script type="text/javascript">
    		    show_banners('top');
    	    </script>
        </div>
    
        <div class="banners">
            <script type="text/javascript">
    		    show_banners('top');
    	    </script>
        </div>
    
        <div class="banners">
            <script type="text/javascript">
    		    show_banners('top');
    	    </script>
        </div>
    
        </script></div>
    </div>
    </body>
    </html>
    
    [B]He stated that these modules would stay in 3 groups of 5 horizontally 5 +5 +5
    But when I apply the script in Joomla only appears in the vertical, ie show the 15 files but all of them vertically one after another.
    Any tips??[/B]
    
    Code (markup):
     
    perplera, Mar 31, 2010 IP