Ok, so I replaced all theimages with myImages. I can't see where the problem is. I can't see where it is, because I am not familiar with javascript.
Can you help pinpoint and fix this script? I REALLY appreciate it.
Thanks so much,
Lorne
PHP Code:
<script type="text/javascript">
var maxImages = 99;
var myImages = new Array();
//
var imgPath = "/bpa-images/Home Slideshow/";
var imgPrefix = "image";
var imgSuffix = ".jpg";
//
function preloadComplete()
{
this.complete = true;
}
function preloadError()
{
this.complete = false;
}
function preloadImages()
{
for (var x=1; x<=maxImages; ++x)
{
myImages[x] = new Image();
myImages[x].onerror = preloadError;
myImages[x].onload = preloadComplete;
myImages[x].src = imgPath + imgPrefix + x + imgSuffix;
}
return true;
}
preloadImages();
///// Plugin variables
playspeed=2000;// The playspeed determines the delay for the "Play" button in ms
dotrans=1; // if value = 1 then there are transitions played in IE
transtype='blendTrans';// 'blendTrans' or 'revealtrans'
transattributes='23';// duration=seconds,transition=#<24
//#####
//key that holds where in the array currently are
i=0;
//###########################################
//if random
function SetRandom() {
tempimage = new Array();
for(p=0; p<myImages.length; p++){
for(p1=0; p1>-1; p1) {
tempNum = Math.floor(Math.random()*myImages.length)
if(!tempimage[tempNum]){
tempimage[tempNum]=myImages[p];
break;
}
}
}
for(p=0;p<myImages.length;p++)myImages[p]=tempimage[p];
}
//###########################################
function SetSlide(num) {
//too big
i=num%myImages.length;
//too small
if(i<0)i=myImages.length-1;
//switch the image
if(document.all&&!window.opera&&dotrans==1)eval('document.images.imgslide.filters.'+transtype+'.Apply()')
document.images.imgslide.src=myImages[i][0];
if(document.all&&!window.opera&&dotrans==1)eval('document.images.imgslide.filters.'+transtype+'.Play()')
}
//###########################################
function PlaySlide() {
if (!window.playing) {
PlayingSlide(i+1);
if(document.slideshow.play){
document.slideshow.play.value=" Stop ";
}
}
else {
playing=clearTimeout(playing);
if(document.slideshow.play){
document.slideshow.play.value=" Play ";
}
}
// if you have to change the image for the "playing" slide
if(document.images.imgPlay){
setTimeout('document.images.imgPlay.src="'+imgStop+'"',1);
imgStop=document.images.imgPlay.src
}
}
//###########################################
function PlayingSlide(num) {
playing=setTimeout('PlayingSlide(i+1);SetSlide(i+1);', playspeed);
}
//###########################################
//desc: picks the transition to apply to the images
function GetTrans() {
//si=document.slideshow.trans.selectedIndex;
I have this posted at the top of my page in the <head> tag. Do I need this at all? Or do I need to edit this?
PHP Code:
var slideimages=new Array()
var slidelinks=new Array()
function slideshowimages(){
for (i=0;i<slideshowimages.arguments.length;i++){
slideimages[i]=new Image()
slideimages[i].src=slideshowimages.arguments[i]
}
}
function slideshowlinks(){
for (i=0;i<slideshowlinks.arguments.length;i++)
slidelinks[i]=slideshowlinks.arguments[i]
}
function gotoshow(){
if (!window.winslide||winslide.closed)
winslide=window.open(slidelinks[whichlink])
else
winslide.location=slidelinks[whichlink]
winslide.focus()
}
Can you supply a live link to the page as it exists on your website? It is awful hard to just look at text and spot errors. Learn how to use a script debugger and it will help you a lot. Firefox has a free debugger called Firebug. If you post a live link, then I can use Firebug on your page to find any problems.
OK, the first problem is that Firefox reports your page as not supplying standards compliance via a valid DOCTYPE. So make sure at least the following is the line right before your opening HTML tag:
HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
Those opening and closing curly apostrophes are invalid. You need to use a straight apostrophe in both positions.
The third problem is that you still have references to theimage instead of myImages.
Lastly, I see that you need to change these:
Code:
function preloadComplete()
{
this.complete = true;
}
function preloadError()
{
this.complete = false;
}
to these because the complete property is read-only.
Code:
function preloadComplete()
{
this.completed = true;
}
function preloadError()
{
this.completed = false;
}
Note that all of this was determined just by looking at the error message being reported by the browser. I did not have to use a script debugger at all (yet). So, it would behoove you to check your error messages, and correct them, before throwing up your hands and just saying "it don't work."
Did anyone ever get this code to work?
If so, I would appreciate Knowing the final outcome.
I have Zero knowledge of code, but need something like this for my home page
Thank You, Butch
Bookmarks