johnnybananas
10-13-2008, 11:03 PM
Hi guys.
I have a webpage with 6 rotating Header Banners. Each one changes after 3 second cycles. I want them to open a new window with their corresponding target destination when each one of these banners is clicked on. I am having trouble trying to get the banners to cycle. Currently, the first banner shows up and clicks to its new window, however, the rest of the banners don't cycle through.
Can someone please help me get this working properly?
Thank you.
The 2 files are shown below..
=== index.html ===
<html>
<head>
<title>Southern California Vacation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="EN-US">
<script src="header.js" language="javascript" type="text/javascript"></script>
</head>
<body bgcolor="#CCCCCC" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="window.setTimeout('cycle();',3000);(loadbanners());(urlswitch());">
<a href="http://www.somepage.com" onclick="this.href=urlswitch()" TARGET= "_blank"><img src="/images/advertisers/headerads/adv1003.jpg" width="468" height="60" border="0" name="banner1"></a>
</body>
</html>
=== header.js ===
<!--
/* Banner Up! - Copyright 1999-2000 By Heidi Allen
Knowledge Hound: The How-To Hunter - Learn how to do almost anything...for free!
Please visit us at http://www.knowledgehound.com
License for use of this script is granted if and only if
this entire copyright notice is included with it. We do not provide
support for this script. It is provided solely as a friendly gesture.
Use at your own risk. Thanks! */
// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
var image="";
var banners=0;
function cycle() {
if (++banners > 6) banners=1; // currently set for 6 rotating banners
loadbanners();
document.banner1.src = image;
window.setTimeout('cycle();',3000); // currently set for a new image every 3 seconds
}
function loadbanners() {
if (banners==1)
{
image="/images/advertisers/headerads/adv1003.jpg";
}
if (banners==2)
{
image="/images/advertisers/headerads/adv1004.jpg";
}
if (banners==3)
{
image="/images/advertisers/headerads/adv1006.jpg";
}
if (banners==4)
{
image="/images/advertisers/headerads/adv1007.jpg";
}
if (banners==5)
{
image="/images/advertisers/headerads/adv1008.jpg";
}
if (banners==6)
{
image="/images/advertisers/headerads/adv1009.jpg";
}
}
//-->
<!--
var link = "http://yahoo.com"
function urlswitch() {
if (banners==1)
{
link = "http://yahoo.com" TARGET= "_blank"; // can change url of every link to its target destination
}
if (banners==2)
{
link = "http://disneyland.disney.go.com" TARGET= "_blank";
}
if (banners==3)
{
link = "http://knotts.com" TARGET= "_blank";
}
if (banners==4)
{
link = "http://http://www.universalstudioshollywood.com" TARGET= "_blank";
}
if (banners==5)
{
link = "http://seaworld.com" TARGET= "_blank";
}
if (banners==6)
{
link = "http://google.com" TARGET= "_blank";
}
return link;
}
//-->
I have a webpage with 6 rotating Header Banners. Each one changes after 3 second cycles. I want them to open a new window with their corresponding target destination when each one of these banners is clicked on. I am having trouble trying to get the banners to cycle. Currently, the first banner shows up and clicks to its new window, however, the rest of the banners don't cycle through.
Can someone please help me get this working properly?
Thank you.
The 2 files are shown below..
=== index.html ===
<html>
<head>
<title>Southern California Vacation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="EN-US">
<script src="header.js" language="javascript" type="text/javascript"></script>
</head>
<body bgcolor="#CCCCCC" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="window.setTimeout('cycle();',3000);(loadbanners());(urlswitch());">
<a href="http://www.somepage.com" onclick="this.href=urlswitch()" TARGET= "_blank"><img src="/images/advertisers/headerads/adv1003.jpg" width="468" height="60" border="0" name="banner1"></a>
</body>
</html>
=== header.js ===
<!--
/* Banner Up! - Copyright 1999-2000 By Heidi Allen
Knowledge Hound: The How-To Hunter - Learn how to do almost anything...for free!
Please visit us at http://www.knowledgehound.com
License for use of this script is granted if and only if
this entire copyright notice is included with it. We do not provide
support for this script. It is provided solely as a friendly gesture.
Use at your own risk. Thanks! */
// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
var image="";
var banners=0;
function cycle() {
if (++banners > 6) banners=1; // currently set for 6 rotating banners
loadbanners();
document.banner1.src = image;
window.setTimeout('cycle();',3000); // currently set for a new image every 3 seconds
}
function loadbanners() {
if (banners==1)
{
image="/images/advertisers/headerads/adv1003.jpg";
}
if (banners==2)
{
image="/images/advertisers/headerads/adv1004.jpg";
}
if (banners==3)
{
image="/images/advertisers/headerads/adv1006.jpg";
}
if (banners==4)
{
image="/images/advertisers/headerads/adv1007.jpg";
}
if (banners==5)
{
image="/images/advertisers/headerads/adv1008.jpg";
}
if (banners==6)
{
image="/images/advertisers/headerads/adv1009.jpg";
}
}
//-->
<!--
var link = "http://yahoo.com"
function urlswitch() {
if (banners==1)
{
link = "http://yahoo.com" TARGET= "_blank"; // can change url of every link to its target destination
}
if (banners==2)
{
link = "http://disneyland.disney.go.com" TARGET= "_blank";
}
if (banners==3)
{
link = "http://knotts.com" TARGET= "_blank";
}
if (banners==4)
{
link = "http://http://www.universalstudioshollywood.com" TARGET= "_blank";
}
if (banners==5)
{
link = "http://seaworld.com" TARGET= "_blank";
}
if (banners==6)
{
link = "http://google.com" TARGET= "_blank";
}
return link;
}
//-->