| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Senior Member Join Date: Nov 2004
Posts: 1,129
![]() ![]() ![]() ![]() | Picture Circulation With Every Page Load - Simple Is there a simple html code that could circulate 2 or more different pictures/banners? For example, if there are two banners to choose from, it would have a 50% chance of one of them to display on my webpage. One could be http://sitename.com/picture.jpg and another http://sitename.com/picture2.jpg. Can I get some code for this? Thanks. |
| |
| | #2 (permalink) |
| DNOA Certified Seller ![]() Join Date: Apr 2005 Location: Arizona
Posts: 3,680
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | I don't think you could do this with pure html, you're gonna need some javascript or php. Just do a search for "banner rotation" on any script search site such as http://www.hotscripts.com and that should do the trick. http://www.focalmedia.net/htmlrotate.html has a script, but I've never used it so I can't vouch for it. Hope this helps, Jorge
__________________ Nombrex.com |
| |
| | #3 (permalink) |
| NamePros Regular Join Date: Aug 2005
Posts: 315
![]() | If javascript is ok, try here. http://www.javascriptcity.com/scripts/local/simage2.htm Just change it to use 2 images not 5
__________________ |
| |
| | #4 (permalink) |
| NamePros Member Join Date: Nov 2005 Location: the Netherlands
Posts: 127
![]() | PHP is easy as well. Have a few lines of code index what's inm a certain folder of banners, and pick a random one out of em. Code: <?php
$path = "directory_full_of_banners";
$handle=opendir($path);
$count = "-1";
while ($file = readdir($handle)) {
if($file!=".."||$file!="."||$file!="Thumbs.db") {
$count++;
$randombannerarray[] = $file;
}
}
$randompick = rand("0",$count);
echo '<img src="'.$path.'/'.$randombannerarray[$randompick].'" />';
?>
__________________ accepts paypal and cookies |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Simple gz compression | GeorgeB | CODE | 3 | 07-01-2005 11:56 AM |
| Good Article: An SEO Checklist | Ferman | Search Engines | 2 | 05-28-2005 11:51 AM |
| Tutorial: Simple site management with the use of PHP and the query string(?page=1) | deadserious | Webmaster Tutorials | 8 | 10-09-2004 02:20 PM |
| Fresh finds HIGh traffic potential including precedents.org. | cjmacd | Domain Names with Traffic Stats | 1 | 04-01-2004 03:14 AM |