|
-
Jun 10th, 2002, 12:36 PM
#1
Thread Starter
Addicted Member
changing img's href dynamically
I'm trying to make a dynamic banner generator. Got the images to rotate randomly on a timer (every 10 seconds a new banner pops up) but I also need to change the href of that image to point to a different url every ten seconds. Here's a look at my code... onload calls setBanner and I got some PHP in there.
function setBanner()
{
randomNumber = Math.floor(Math.random()*<?echo($numberBanners);?>);
document.mybanner.src=''+bannerz[4]+'';
setTimeout("pickBanner()", 8000);
}
function pickBanner()
{
randomNumber = Math.floor(Math.random()*<?echo($numberBanners);?>);
document.mybanner.src=''+bannerz[randomNumber]+'';
//document.mybanner.href=''+urls[randomNumber]+'';
window.status = "Banner is now ... "+bannerz[randomNumber];
setTimeout("pickBanner()", 8000);
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|