Trying to build a flash rotator which takes some swf from a db and rotates them.
In the head I have -
<script type="text/javascript">
-
clock_ads(1);
-
function clock_ads(i)
-
{
-
<?php
-
$q1=mysql_query("select * from banners");
-
$c1=mysql_num_rows($q1);
-
if ($c1>0) //got banners and ok to show
-
{
-
$maxy=0;
-
//check if only one entry
-
for ($j=1;$j<=$c1;$j++)
-
{
-
$q2=mysql_query("select * from banners where banorder='$j'");
-
$r2=mysql_fetch_array($q2);
-
$file="banners/".$r2[1];
-
$size=getimagesize($file);
-
if ($size[1]>$maxy) $maxy=$size[1];
-
$life=$r2[3];
-
if ($j==1) echo "if"; else echo "else if";
-
?>
-
(i=='<?php echo $j;?>')
-
{
-
//check to see how we will display the ad based on the type (flash or image)
-
-
if ( ("<?php echo $r2[1];?>".search(/.swf/i))>0 )
-
{
-
-
swfobject.embedSWF("<?php echo $file;?>", "myContent", "<?php echo $size[0];?>", "<?php echo $size[1];?>", "9.0.0");
-
-
}
-
else
-
{
-
-
document.getElementById("myContent").innerHTML="<img border='0' src='<?php echo $file;?>' />";
-
-
}
-
if (<?php echo $c1?>!='1')
-
setTimeout("clock_ads(<?php echo $j+1;?>)",<?php echo $life;?>);
-
}
-
<?php
-
}
-
}//if ($c1>0) //got banners and ok to show
-
?>
-
if (i><?php echo $c1;?>) clock_ads(1);
-
}
-
</script>
-
and in the body a -
<div id="myContent">
-
<h2><?php echo GET_FLASH;?></h2>
-
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
-
</div>
-
when I have only swf it works ok but when I also use images I get an error that
mycontent is null meaning that it cannot find the div, as I see it the -
document.getElementById("myContent").innerHTML="<img border='0' src='<?php echo $file;?>' />";
-
is for some reason relating to the swf wrong logic any help?
PS Even when I moved the script below the div in the body the image was shown once and only when it was shown before a swf after that it was simply ignored and the page showed only the swfs
2 1775
a bit of further explanation about the code, all it does is to generate a javascript to do the job e.g. an image ELNAVI.jpg and after that 2 swf we have this -
<script type="text/javascript">
-
clock_ads(1);
-
function clock_ads(i)
-
{
-
if (i=='1')
-
{
-
//check to see how we will display the ad based on the type (flash or image)
-
if ( ("ELNAVI.jpg".search(/.swf/i))>0 )
-
{
-
swfobject.embedSWF("banners/ELNAVI.jpg", "myContent", "160", "37", "9.0.0");
-
}
-
else
-
{
-
document.getElementById("myContent").innerHTML="<img border='0' src='banners/ELNAVI.jpg' />'";
-
}
-
if (3!='1')
-
setTimeout("clock_ads(2)",8000);
-
}
-
else if (i=='2')
-
{
-
//check to see how we will display the ad based on the type (flash or image)
-
if ( ("gmlogoA.swf".search(/.swf/i))>0 )
-
{
-
swfobject.embedSWF("banners/gmlogoA.swf", "myContent", "779", "136", "9.0.0");
-
}
-
else
-
{
-
document.getElementById("myContent").innerHTML="<img border='0' src='banners/gmlogoA.swf' />'";
-
}
-
if (3!='1')
-
setTimeout("clock_ads(3)",5000);
-
}
-
else if (i=='3')
-
{
-
//check to see how we will display the ad based on the type (flash or image)
-
if ( ("alba468x60msc150609.swf".search(/.swf/i))>0 )
-
{
-
swfobject.embedSWF("banners/alba468x60msc150609.swf", "myContent", "468", "60", "9.0.0");
-
}
-
else
-
{
-
document.getElementById("myContent").innerHTML="<img border='0' src='banners/alba468x60msc150609.swf' />'";
-
}
-
if (3!='1')
-
setTimeout("clock_ads(4)",5000);
-
}
-
if (i>3) clock_ads(1);
-
}
-
</script>
acoder 16,027
Recognized Expert Moderator MVP
See line 14: - document.getElementById("myContent").innerHTML="<img border='0' src='banners/ELNAVI.jpg' />'"
You have an extraneous ' (single quote).
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Francis Lavoie |
last post by:
Hello
I have some questions regarding webframework, I must say that I quite
lost and these questions are basicly to help me understand the way it work.
I have some knowledge with PHP and JSP.
I have looked for a python web framework to build a web site, a site
that I had start in php (and quite finish), but for some reason I wont
explain, I lost everything. I have started writting app with python 6
|
by: Mike |
last post by:
Hello,
I have a few rather urgent questions that I hope someone can help with (I
need to figure this out prior to a meeting tomorrow.) First, a bit of
background: The company I work for is developing a web-based application,
one part of which involves allowing the user the ability to page through
transaction "history" information.
The _summary_ history table will have the following fields: ServiceName,
Date, User-Ref1, User-Ref2,...
|
by: dragze |
last post by:
Hi,
On one of the pages of my site i use two javascripts, one makes transparency of png's work in IE, and the other embeds a flash player.
Now use one of the scripts it works fine, use both and the transparency script stops working. So for example, use just the png transparency script and it displays the png's correctly in IE, as soon as i add the SWFobject (flash embedding) script the transparency script stops working!!?? :S
Any help...
|
by: K. |
last post by:
Hello!
I have a problem with javascript script called: SWFObject.
I have a web page which displays on IE 7.0. i Firefox in a good way.
All flash objects are displayed on a web page.
The problem is on IE 6.0. I have i.e. 9 flash swf objects, but only 6 of
them
are displayed. I don`t know why. I think it is not my fault as a code
programmer.
|
by: anfetienne |
last post by:
is it possible to add php array to vars in the swfobject code?
| |
by: yogarajan |
last post by:
hi friend
this is my code
<script type="text/javascript">
// <!]>
</script>
it is working fine for (open file)
file:///D:/WebSite4/swfobject/swfobject1-5/fullpage.html
|
by: jay11 |
last post by:
Hello peeps
I am trying to run a banner with SWFObject from within PHP/Mambo.
I have two others SWF in the same page, so I know it works.
Also checked the Developer tool in Chrome and saw that the .js file was loaded.
Clicked the link of the SWF I want to see displayed and it runs in another window.
Also if I call it via localhost ..../x.swf it works.
It just DOESN'T work when called from within PHP.
Here is the code I am using. If any...
|
by: jeddiki |
last post by:
I am reading up on this swfobject which uses javascript to embed the
swf files.
They say that I need to have adobe flash player 9.0
Well I was going to use Flowplayer.
Does this mean that if I use swfobject then I can not use Flowplayer?
Or am I getting mixed up ?
|
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...
|
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,...
|
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...
| |
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,...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |