DeveloperBarn Forums

Go Back   DeveloperBarn Forums > Programming & Scripting > Code Samples > JavaScript

Discuss "Random Banner Ad" in the JavaScript forum.

JavaScript - Post your JavaScript code samples here.


Reply « Previous Thread | Next Thread »  
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old March 19th, 2008, 08:19 PM
jmurrayhead's Avatar
Your Lord & Master

 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 530
Thanks: 14
Thanked 38 Times in 37 Posts
Blog Entries: 2
Rep Power: 1
jmurrayhead is on a distinguished road

Awards Showcase
Microsoft .Net Microsoft SQL Server Microsoft Windows Classic ASP 
Total Awards: 4

Default Random Banner Ad

Code:
<html>
<head>
<!--
This file retrieved from the JS-Examples archives
http://www.js-examples.com
1000s of free ready to use scripts, tutorials, forums.
Author: Artem - http://javascript4free.by.ru 
-->
 
</head>
<body>
<script LANGUAGE="JavaScript">
// !!! Reload page
// add 1,2,3 'img'
var NumberOfAds = 4;
var now = new Date()
var sec = now.getSeconds()
var AdNumber = sec % NumberOfAds;
AdNumber +=1;
if (AdNumber==1)
{
 url="http://www.developerbarn.com/";
 Graphic="/js/images/pic1.gif";
 width = "220"
 height = "40"
}
if (AdNumber==2)
{
 url="http://www.developerbarn.com/";
 Graphic="/js/images/pic2.gif";
 width = "220"
 height = "40"
}
if (AdNumber==3)
{
 url="http://www.developerbarn.com/";
 Graphic="/js/images/pic3.gif";
 width = "268"
 height = "50"
}
if (AdNumber==4)
{
 url="http://www.developerbarn.com/";
 Graphic="/js/images/pic4.gif";
 width = "220"
 height = "40"
}
 
document.write('<center>');
document.write('<a href=\"' + url + '\">');
document.write('<img src=\"' + Graphic + '\" width=')
document.write(width + ' height=' + height + ' ');
document.write('border=0><br>');
document.write('</a>');
document.write('</center>');
 
</script>
<br>
<center>REST OF HTML  DOCUMENT HERE
<br><b><font color=red>Type reload some times, You will see change</font><BR><center><a href='http://www.developerbarn.com'>JS-Examples.com</a></center> 
</body>
</html>
Reply With Quote
Sponsored Links
Reply

  DeveloperBarn Forums > Programming & Scripting > Code Samples > JavaScript

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Sponsored Links

ASP.NET Resource Index
a directory of ASP.NET tutorials, applications, scripts, assemblies and articles for the novice to professional developer.

Free Web Directory
Including Chats and Forums Resources, Offer automatic, instant and free directory submissions.
URLZ Web Directory
URLZ Web Directory

Free Web Directory - Add Your Link
The Little Web Directory
Free Web Directory
Pegasus free web directory is a free directory organised by categories.

Web Directory & SEO Services
dirroot web directory


All times are GMT -4. The time now is 07:48 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
Copyright © 2008 DeveloperBarn.com

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46