Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Old 02-05-2007, 05:45 AM ad Rotator
millwalll's Avatar
Webmaster Talker

Posts: 674
Name: James
Location: KENT
Trades: 3
Hi all,

Is there a way I can have ad's on my website where i add let say 10 banners to it and every time i reload the web page it will load a new banner ?
__________________

Please login or register to view this content. Registration is FREE
millwalll is offline
Reply With Quote
View Public Profile Visit millwalll's homepage!
 
 
Register now for full access!
Old 02-05-2007, 07:07 AM Re: ad Rotator
vn5ltr's Avatar
Skilled Talker

Posts: 93
Location: Melbourne, Australia
Trades: 0
Depends on what language you are planning to use.
I'm assuming you have an understanding of Javascript...

Here is a simple and dirty example if your banners were named something like 'banner0.gif, banner1.gif, banner2.gif...etc' all the way up to banner9.gif (0 to 9)

Code:
<html>
<head>
<title>test</title>
<script>
function adrotator()
{
//get a number from 0 to 9
var randomnum = Math.floor(Math.random()*10);
//write the image to the layer 'adarea'
document.getElementById('adarea').innerHTML = '<img src=\'banner' + randomnum + '.gif\' \>';
}
</script>
</head>
<body onload="adrotator();">
<div id="adarea"></div>
</body>
</html>
Otherwise, your best option would be to use a server-side language like PHP or ASP where you can apply the same principle quite easily.

Cheers.
vn5ltr is offline
Reply With Quote
View Public Profile
 
Old 02-05-2007, 07:26 AM Re: ad Rotator
scottfree's Avatar
Extreme Talker

Posts: 234
Location: Hamburg
Trades: 0
I would say this is one of the best methods.
Otherwise you could start with an array of the banner images names, choose a random number between the start and end of the array and disply that image. That way it will always be random.
__________________
I think, therefore I am..... I think.
scottfree is offline
Reply With Quote
View Public Profile Visit scottfree's homepage!
 
Old 02-05-2007, 05:47 PM Re: ad Rotator
MarbleHost.com's Avatar
Experienced Talker

Posts: 42
Trades: 0
You can use javascript or php. Javascript is easy solution, php offers more control. E. g. phpadsnew can not only rotate banners but also provide you with quality stats.
__________________

Please login or register to view this content. Registration is FREE

Reliable
Please login or register to view this content. Registration is FREE
provided since 2005

Please login or register to view this content. Registration is FREE
- build your website right now
MarbleHost.com is offline
Reply With Quote
View Public Profile Visit MarbleHost.com's homepage!
 
Reply     « Reply to ad Rotator
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23953 seconds with 12 queries