Neler yeni
Türkiye'nin En Güncel Forum Sitesi

Forum içeriğine ve tüm hizmetlerimize erişim sağlamak için foruma kayıt olmalı yada giriş yapmalısınız. Forum üye olmak tamamen ücretsizdir.

Simple Banner Rotator (ing)

ByOnur58

Kayıtlı Üye
MFC Üyesi
  • Üyelik Tarihi
    7 Ocak 2015
  • Mesajlar
    2,113
  • MFC Puanı
    10
  • MFC Seviyesi

Kod:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
// Simple banner rotator
// (c) spyka Web Group 2008
// version info: 1.1.2
// Download & support: http://www.spyka.net
// Forums: http://www.spyka.net/forums
// Please keep this notice in place

function banner(name, url, image, date)
{
    this.name    = name;
    this.url    = url;
    this.image    = image;
    this.date    = date;
}

var banners = new Array();
///////////////////////////////////////////////////////////////////////////////////
//
//                                 START EDITS HERE
//
///////////////////////////////////////////////////////////////////////////////////

// Full ********ation & support: http://www.spyka.net/forums 

// if 1, all images will be resized to img_width and img_height, else images will display their correct size
var force_size    = 0;
// desired height and width of images, only takes affect if above is = 1
var img_width    = 728;
var img_height    = 90;

// banner list syntax: banners[x] = new banner(website_name, website_url, website_image_url, show_until_date);  DATE FORMAT: dd/mm/yyyy
banners[0] = new banner('AwesomeStyles', 'http://www.awesomestyles.com', 'http://www.awesomestyles.com/images/aimg/728x90-1.gif', '30/04/2009');
banners[1] = new banner('spyka.net Webmaster', 'http://www.spyka.net', 'http://spyka.net/images/88x31.jpg', '10/04/2009');

///////////////////////////////////////////////////////////////////////////////////
//
//                                 END EDITS HERE
//
///////////////////////////////////////////////////////////////////////////////////

function show_banners()
{
    var am        = banners.length;
    var rand    = Math.floor(Math.random()*am);    
    var bn         = banners[rand];
    
    var image_size     = (force_size == 1) ? ' width="' + img_width + '" height="' + img_height + '"' : '';
    var html         = '<a href="' + bn.url + '" title="' + bn.name + '" target="_blank"><img border="0" src="' + bn.image + '"' + image_size + ' alt="' + bn.name+ '" /></a>';
    
    // get current date string
    var now        = new Date(); 
    
    var input    = bn.date;
    input        = input.split('/', 3);
    var end_date    = new Date();
    end_date        = end_date.setFullYear(parseFloat(input[2]), parseFloat(input[1]), parseFloat(input[0]));
    
    (now < end_date) ? ********.write(html) : show_banners();
}
</script>
<**** http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Example</title>
<script type="text/javascript" src="banners.js"></script>
</head>

<body>
<script type="text/javascript">
show_banners();
</script>
</body>
</html>
 
Üst Alt