HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old April 26th, 2008, 02:05 PM
Drazen Drazen is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 23 Drazen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 h 27 m 9 sec
Reputation Power: 0
A little help with this Javascript slideshow needed

I have this fairly simple code i got from a Java site for a fading slideshow.
It works fine, but i want to loop 10 pictures. The code i copied and pasted was for 5 pics, it said to just keep adding the paths of the pics. This I did, but even though there are 10 pics there it will only scroll through 5, ignoring the other 5.

What am i doing wrong?


Code:
<script>
// (C) 2000 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this  header
// NS4-6,IE4-6
// Fade effect only in IE; degrades gracefully

// =======================================
// set the following variables
// =======================================

// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 3000

// Duration of crossfade (seconds)
var crossFadeDuration = 3

// Specify the image files
 // don't touch this
// to add more images, just continue
// the pattern, adding to the array below
var Pic = new Array()
Pic[0] = 'slideshow_images/1.jpg'
Pic[1] = 'slideshow_images/2.jpg'
Pic[2] = 'slideshow_images/3.jpg'
Pic[3] = 'slideshow_images/4.jpg'
Pic[4] = 'slideshow_images/5.jpg'
Pic[5] = 'slideshow_images/6.jpg'
Pic[6] = 'slideshow_images/7.jpg'
Pic[7] = 'slideshow_images/8.jpg'
Pic[8] = 'slideshow_images/9.jpg'
Pic[9] = 'slideshow_images/10.jpg'

// =======================================
// do not edit anything below this line
// =======================================

var t
var j = 0
var p = Pic.length

var preLoad = new Array()
for (i = 0; i < p; i++){
   preLoad[i] = new Image()
   preLoad[i].src = Pic[i]
}

function runSlideShow(){
   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply  ()      
   }
   document.images.SlideShow.src = preLoad[j].src
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play(  )
   }
   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
}
</script>


Thanks in advance

Reply With Quote
  #2  
Old April 27th, 2008, 08:44 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,397 Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)  Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 3 Days 22 h 32 m 47 sec
Reputation Power: 1311
the code is fine, you probably see cached page.
clear your IE cache and try again.

Reply With Quote
  #3  
Old April 27th, 2008, 01:57 PM
Drazen Drazen is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 23 Drazen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 h 27 m 9 sec
Reputation Power: 0
Hi, thanks for looking. I've cleared my IE cache and still the same, only 5 in rotation.

I've also tried on another computer thats not been to the page before and its still 5 in rotation on that one too.

It seems crazy, I don't understand javascript very well at all, but I can just about understand it and i can't see why it only rotates 5.

I have viewed the source of the web page when its loaded and its identical to the script posted above.

I have also tried forcing 'var p' to = 10, but still it only rotates through 5.

its nuts

Reply With Quote
  #4  
Old April 28th, 2008, 06:54 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,397 Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)  Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 3 Days 22 h 32 m 47 sec
Reputation Power: 1311
add the bolded line to the function in order to debug this:
Code:
function runSlideShow(){
   alert(Pic.length + "\n" + preLoad.length);
   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply    ()      
   }
   document.images.SlideShow.src = preLoad[j].src
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play(    )
   }
   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
}

Reply With Quote
  #5  
Old April 28th, 2008, 03:30 PM
Drazen Drazen is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 23 Drazen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 h 27 m 9 sec
Reputation Power: 0
I added the line and evertime i get a new slide i get the message 10 10.

I get the feeling this is how it should be, but still ony 5 rotate. (

I'm not sure if it matters, but the 'head' part of the java is on one page, and the other part (where the slide show is) is on another web page that is incuded on this one.
where i use <!--#Include file="right_column.asp"-->

Reply With Quote
  #6  
Old April 29th, 2008, 01:30 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,397 Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)  Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 3 Days 22 h 32 m 47 sec
Reputation Power: 1311
ok, second step of the debug:
Code:
alert(j + "\n" + p);

Reply With Quote
  #7  
Old April 29th, 2008, 05:02 AM
Drazen Drazen is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 23 Drazen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 h 27 m 9 sec
Reputation Power: 0
now i get 0-5 1-5 2-5 3-5 4-5 then back to 0-5

Reply With Quote
  #8  
Old April 29th, 2008, 09:37 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,397 Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)  Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 3 Days 22 h 32 m 47 sec
Reputation Power: 1311
this works flawlessly at my computer.
please zip your whole page as-is and attach it here.

Reply With Quote
  #9  
Old April 29th, 2008, 12:19 PM
Drazen Drazen is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 23 Drazen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 h 27 m 9 sec
Reputation Power: 0
I hope this works


its crazy why this dosn't work.

I've just copied and paset the code onto a blank page and it works fine on a new page.

There is a javascript menu on the page, but its far beyond me to underatand it. i used Allwebmenu pro to construct it. If that helps

Reply With Quote
  #10  
Old April 30th, 2008, 02:51 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,397 Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)  Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 3 Days 22 h 32 m 47 sec
Reputation Power: 1311
then something in the other .js code is messing up with one of the variables.
try to change your code to this:
Code:
// ==============================================
// do not edit anything below this line (unless the code does not work and need to be fixed)
// ==============================================

var _fadeTimerSeed = 0;
var _fadeCurrentIndex = 0;
var _fadeImageCount = Pic.length;

var preLoad = new Array()
for (i = 0; i < _fadeImageCount; i++){
   preLoad[i] = new Image()
   preLoad[i].src = Pic[i]
}

function runSlideShow(){
	if (document.all)
	{
		document.images.SlideShow.style.filter = "blendTrans(duration=2)";
		document.images.SlideShow.style.filter = "blendTrans(duration=crossFadeDuration)";
		document.images.SlideShow.filters.blendTrans.Apply  ();
	}
	
	document.images.SlideShow.src = preLoad[_fadeCurrentIndex].src;
	
	if (document.all)
	{
		document.images.SlideShow.filters.blendTrans.Play(  );
	}
	
	_fadeCurrentIndex = _fadeCurrentIndex + 1;
	if (_fadeCurrentIndex > (_fadeImageCount - 1))
		_fadeCurrentIndex = 0;
	
	_fadeTimerSeed = setTimeout('runSlideShow()', slideShowSpeed);
}
Comments on this post
Drazen agrees: Very, very helpfull

Last edited by Shadow Wizard : May 1st, 2008 at 04:48 AM.

Reply With Quote
  #11  
Old April 30th, 2008, 11:37 AM
Drazen Drazen is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 23 Drazen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 h 27 m 9 sec
Reputation Power: 0
Thats fixed it.

Thank you soooooo much for your help

Reply With Quote
  #12  
Old May 1st, 2008, 04:47 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,397 Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 5th Grade (Above 100000 Reputation Level)  Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1Folding Points: 313769 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 3 Days 22 h 32 m 47 sec
Reputation Power: 1311
cheers, glad I could help.
feel free to email those who wrote the code and notify them
of their problem - the code is poorly written.
this way maybe they will change the code and use real variable
names and thus make the code better and such problems as yours
will be prevented.

the greatest mistake of those writing "shared" code is the
assumption their code is the only code that will ever exist
in the page. well, they're wrong and your case prove this.

you can send them link to this thread.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > A little help with this Javascript slideshow needed


Thread Tools  Search this Thread