473,573 Members | 2,831 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 5274
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
1272
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...
10
2491
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...
0
3380
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
4268
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....
2
4763
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...
1
1478
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...
0
7755
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...
0
7679
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...
0
7992
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. ...
0
8190
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...
1
7756
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...
1
5571
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...
0
5281
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3722
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...
1
2183
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.