473,703 Members | 3,002 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Swapping random flash banners

I am trying to swap/rotate random flash banners using the following
Javascript code. I have 3 flash headers/banners. I can get it to
open a page with a random header using document.write( randomHeader) in
the chooseHeader() function, but the rest of the page doesn't get
displayed with that approach.

Instead, what I would like to do is comment the
document.write( randomHeader) line, and use the random reference I have
in the table cell towards the bottom of the file.

Also, the setTimeout method in the Timer() function produces an
"Object expected" error. I've tried giving it more time, to no avail.
window.setTimeo ut("Timer()",15 000);

Could someone point out corrections I need to make, or alternate
solutions (using Javascript)?

Thank you, Terry
<html>
<head>
<title>ACP - Healthcare/Long Term Care : About our Company</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<script language="JavaS cript" type="text/JavaScript">
<!--
var headerCount = 3
flashHeader0= new Object();
flashHeader0.sr c = ('<object
classid="clsid: D27CDB6E-AE6D-11cf-96B8-444553540000" width="750"
height="95"><pa ram name="movie"
value="sports_f lash_header.swf "></object>');
flashHeader1= new Object();
flashHeader1.sr c = ('<object
classid="clsid: D27CDB6E-AE6D-11cf-96B8-444553540000" width="750"
height="95"><pa ram name="movie"
value="sports_f lash_header_alt _gym.swf"></object>');
flashHeader2= new Object();
flashHeader2.sr c = ('<object
classid="clsid: D27CDB6E-AE6D-11cf-96B8-444553540000" width="750"
height="95"><pa ram name="movie"
value="sports_f lash_header_alt _volley.swf"></object>');
randomHeader= new Object();

function chooseHeader(){
randomNum = Math.floor((Mat h.random() * headerCount));
randomHeader = eval("flashHead er" + randomNum + ".src");
document.write( randomHeader);
startTime();
}

function startTime(){
var time= new Date();
hours= time.getHours() ;
mins= time.getMinutes ();
secs= time.getSeconds ();
closeTime=hours *3600+mins*60+s ecs;
closeTime+= 15; // How many seconds til the next rotation
Timer();
}

function Timer(){
var time= new Date();
hours= time.getHours() ;
mins= time.getMinutes ();
secs= time.getSeconds ();
curTime=hours*3 600+mins*60+sec s;
if (curTime>=close Time){
chooseHeader();
}
else{
// I don't understand why this line causes an "Object expected" error.
// window.setTimeo ut("Timer()",15 000);
}
}

//-->
</script>
<link href="style_she ets/acp_style.css" rel="stylesheet "
type="text/css" />
</head>
<body background="ima ges/elements/bg_grid.gif" leftmargin="0"
topmargin="5" bottommargin="5 " marginwidth="0" marginheight="0 "
onLoad="chooseH eader();">
<table width="750" border="0" align="center" cellpadding="0"
cellspacing="0" >
<tr>
<td>
<table width="752" border="0" cellpadding="0" cellspacing="0"
bgcolor="#FFFFF F">
<tr>
<td width="1" rowspan="7" align="left" valign="top"
background="var/www/html/newsite/images/elements/pxl_black.gif">
<img width="1" height="100%" />
</td>
<td>
<img src="images/elements/pxl_black.gif" width="750"
height="1" />
</td>
<td width="1" rowspan="7" align="left" valign="top"
background="var/www/html/newsite/images/elements/pxl_black.gif" />
</tr>
<!--tr>
<td width="750" height="95" align="left" valign="top">
<img name="banner" border="0" />
</td>
</tr-->
<!--Single reference works fine (when document.write in chooseHeader()
is commented): -->
<!--tr>
<td>
<object classid="clsid: D27CDB6E-AE6D-11cf-96B8-444553540000"
width="750" height="95">
<param name="movie"
value="sports_f lash_header_alt _volley.swf">
<!--param name="quality" value="high"-->
<!--embed src="sports_fla sh_header_alt_v olley.swf"
quality="high" pluginspage="ht tp://www.macromedia. com/go/getflashplayer"
type="applicati on/x-shockwave-flash" width="750"
height="95"></embed-->
</object>
</td>
</tr-->
<!--This random reference is what I want to use (when document.write
in chooseHeader() is commented): -->
<tr>
<td width="750" height="95" align="left" valign="top">
<embed name="movie" border="0" />
<embed src=flashHeader 0.src border="0" />
</td>
</tr>
<tr>
<td width="750">
<div align="center">
<h3>&copy; 2000-2004 Accelerated Care Plus Corporation, All
Rights Reserved <a href="terms.htm l">Terms of Use</a>
</h3>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Jul 23 '05 #1
1 5287
JRS: In article <7b************ **************@ posting.google. com>,
dated Fri, 3 Dec 2004 09:57:03, seen in news:comp.lang. javascript, Terry
Haufler <te**********@a cplus.com> posted :
var time= new Date();
hours= time.getHours() ;
mins= time.getMinutes ();
secs= time.getSeconds ();
closeTime=hours *3600+mins*60+s ecs;


Better done with
closeTime = new Date().valueOf( ) / 1000 | 0
unless you do want rollback at midnight (add %86400), on plausible
assumptions about how you use it.

When posting code to News, do not allow your software to introduce line
breaks; it has the effect of making some of us not bother to read it.
Use two spaces, not a tab, as the indent unit.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demo n.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demo n.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1278
by: Ann | last post by:
Hi all, Is it possible to have flash banners in headers and in the pages of a plone site..I have downloaded CMFFlashMovie 0.3.2. I can upload(add flashcontent) on a page by itself on the plone site. But i want to integrate it with the other pages. For eg: in the "AboutUs" page i want a Flash movie to play at the left most side..And I want a flash banner in the header..I have been searching on how to do this, but i haven't come across...
10
2499
by: Virus | last post by:
Ok well what I am trying to do is have 1.) the background color to change randomly with 5 different colors.(change on page load) 2,) 10 different quotes randomly fadeing in and out in random spots on the webpage. with a delay timer on them, so they keep changing as the page is open. Not random each time the page is loaded. If anyone can help it would be greatly appreaciated, I have tried many of
0
3393
by: DDK | last post by:
Does anyone know if the asp.net adrotator control supports flash banners. If so, how does the XML file look with a flash banner in it. I am trying to get a .swf flash file to work with the adrotator and it doesn't seem to be displaying. I just not sure what needs to done. Any info would be much appreciated, D.
1
4276
by: sven.daems | last post by:
Hy I want to add a sort of news service to my site. I've a number of messages, wich I want to be shown in a <marquee> tag. I've found a simple scrit that generates an random message (wich I've putted in an array) and the message is shown in an marquee tag. The problem is that for changing the message, a reload of the page is required. Isn't there a way to reload the message? Or every time the marquee tag shows a message, it will be a...
2
4774
by: Crash44 | last post by:
This is driving me quite nuts. I have created several flash banners for a record label. They are meant to link to an artist splash page. Simple enough, right? Both Mac and PC users can click on these banners on my corporate client page, and anywhere else on the web for that matter, but the banners don't work for Mac users on Myspace - just Mac users. They can see the banner. the banner animates as it should, but clicking the banner produces...
1
1483
by: Kal | last post by:
Hi everyone, I have a simple sight that has a unique flash banner for every button of my navigation. so my navigation looks something like this (home, services, location, etc..) when a user clicks on home, it has a flash banner specific to home, same deal for the other sections. This works fine, but I have an iFrame in the middle of my site (i did this in order to maintain my formatting for pages with long text). If someone is in...
0
8743
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8659
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9239
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9102
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8995
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7844
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6585
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4417
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2424
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.