View Full Version : Java Applet in PHP?

01-24-2005, 11:43 PM
Hi everyone,
I have been reading this great forum for a while now. :thumbsup:
There are some smart folks here that I hope can help me out!

I'm trying to ad a java applet rotating banner to my forum header next to our existing banner. It seems that the applet is working, but it can't seem to find the images for it. I have tried every path to get to the images....but nothing. :(
Can anyone tell me what im doing grong? I would greatly appeciate any imput on this problem im having!! Thanks guys!

The website is www.coloradoprospector.com/forums


01-24-2005, 11:50 PM
It's not an applet, it's a JavaScript image rotation script. At first glance (without even touching your JS code), the problem seems to be that you're rotating the images before they can load.

I can't remember too well from the days I was primarily coding JavaScript, but I think the solution is to load the images before starting the rotation.

01-25-2005, 01:23 AM
Thanks cfc. Your right, I meant to say script....lol
Thats what no sleep does to you. The script does have the command to tell it to preload the images already.

This is the code for the script.
(This is the part I put in the Header)
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Original: ShuvoRim (shuvorim@hotmail.com ) -->
<!-- Web Site: http://www.shuvorim.tk -->
<script language="JavaScript" type="text/JavaScript"><!--

/* author@ShuvoRim
* http://www.shuvorim.tk/
* shuvorim@hotmail.com
* (c)ShuvoRim Pvt. Ltd. 2002 -03
* All rights reserved.
* --------------------------------------------------
* visit our web site for more free Java applications
* and applets. Thank you for using our program.
* --------------------------------------------------

var urlArray = new Array(4); //for URL's, increase size as necessary
var banArray = new Array(4); //for banners, increase size as necessary
var counter = 1;
var url = "http://www.coloradoprospector.com"; //initial URL

//add your necessary URL's
urlArray[0] = "http://www.coloradoprospector.com/Advertising/advertising.html";
urlArray[1] = "http://www.minersresponseteam.org";
urlArray[2] = "http://www.coloradoprospector.com/Vic's_Gold_Panning/vics.html";
urlArray[3] = "http://www.coloradoprospector.com/Advertising/advertising.html";

if(document.images) //pre-load all banner images
for(i = 0; i < 4; i++)
banArray[i] = new Image(318, 54);
banArray[i].src = "banner" + (i+1) + ".jpg";

function changeBanner() //banner changer function
if(counter > 3)
counter = 0;

document.banner.src = banArray[counter].src; //sets a new banner

url = urlArray[counter]; //sets a new URL to the banner
counter++; //increase the counter for the next banner

//calls the changeBanner() function every 3 seconds
//change the timer as necessary (minutes * 60000) or (seconds * 1000)
var timer = window.setInterval("changeBanner()", 3000);



(This is the part I put in the body)

<a href="#" onClick="window.open(url,'BannerWin');">
<img src="banner1.jpg" width=318 height=54 border=2 name="banner"></a>

I have all the images for the banner flying open on the site in the public_html folder with the index.html.
This script seems to work everywhere else on my site besides in the forum.

Im still lost!? Help?..... :o

Sorry for the long post!

01-25-2005, 01:37 AM
Hi , since this is a javascript question , I am moving it to the javascript forum.

01-25-2005, 01:47 AM
Thanks firepages! Sorry, I promise to get some sleep... :D