473,324 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Javascript play/stop in gallery

Hi all i am having trouble with my play and stop buttons in my javascript gallery. When you first load the gallery and try and play the gallery you first have to press stop before you can press play, does any body have any idea as why this may be? I have tried to change the

Expand|Select|Wrap|Line Numbers
  1. document.getElementById("play").disabled="disabled";
  2. document.getElementById("stop").disabled="";

to true and false but this doesn't seem to work, instead the buttons stop working all together.


Expand|Select|Wrap|Line Numbers
  1.  
  2. var i = 0, imageSorce = new Array(), preload = new Array();//add an array to cycle through the images
  3. imageSorce[0]="Assets/images/big/0.jpg";
  4. imageSorce[1]="Assets/images/big/1.jpg";
  5. imageSorce[2]="Assets/images/big/2.jpg";
  6. imageSorce[3]="Assets/images/big/3.jpg";
  7. imageSorce[4]="Assets/images/big/4.jpg";
  8. imageSorce[5]="Assets/images/big/5.jpg";
  9. imageSorce[6]="Assets/images/big/6.jpg";
  10. imageSorce[7]="Assets/images/big/7.jpg";
  11.  
  12. for (var j=0; j<imageSorce.length;j++)
  13. {
  14. preload[j] = new Image;
  15. preload[j].src = imageSorce[j];
  16.  
  17. }
  18. function mode(param)
  19. {
  20. smode=param;
  21. }
  22.  
  23. function startSlideshow()//as the name suggests it starts the slideshow when play is clicked.
  24. {
  25. if(smode=="play")
  26. {
  27. document.getElementById("play").disabled="disabled";
  28. document.getElementById("stop").disabled="";
  29. document.getElementById("slide").src=imageSorce[i];
  30. document.getElementById('captionarea').innerHTML=caption[i];//adds captions when the gallery is played.
  31.  
  32. i++;
  33. setTimeout("startSlideshow()",3000);
  34.  
  35. }
  36.  
  37. else if(smode=="stop")
  38. {
  39. document.getElementById("stop").disabled="disabled";
  40. document.getElementById("play").disabled="";
  41. document.getElementById("play").value="";
  42.  
  43. }
  44. if(i==imageSorce.length)
  45. {
  46. i=0;
  47.  
  48. }
  49. }
  50.  
  51.  
  52.  
can anybody help me figure this out?
Oct 4 '11 #1
1 1950
acoder
16,027 Expert Mod 8TB
Make sure stop is initially disabled. Also, could you post the corresponding HTML code?
Oct 13 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: HC | last post by:
Hi all, Can Javascript be used to stop loading in another frame? I'm writing a script that does the following: 1) Start loading a page in another frame 2) If after 10 seconds the page...
9
by: Morris Neuman | last post by:
Im working with VS 2005 and trying to use a Hyperlink field in a datagrid to play a wave file that is not located in the website folders but is in a plain folder on the same machine, windows 2003...
3
by: tess | last post by:
We are coding a popup window on exit of our site. We do not want this popup to occur if someone hits the back button. How do we stop this. Any hints?
3
by: hardcorey | last post by:
i basically have a couple songs that ive made on my site, and im using an onClick event to play each song. basically the onClick event calls the javascript function. heres my javascript: ...
3
by: Steve | last post by:
Hi; I'm working on a demo of using a timer on a web site that is made visible by making a div visible. My "PopIn Box" div is empty on the page. Before making it visible I used javascript to...
3
by: aromes | last post by:
Hi, How to grab pictures out of php/javascript online photo gallery? Thanks PS: Really sorry of similar questions were posted. They were posted on the relevant / different forums for php / java...
3
by: jwidener117 | last post by:
i am well virsed in html and CSS but I am making a new portfolio site for myself and I would like to implement some java for a simple way to display my images, using my links to the left when the...
2
by: dinesh1985singh | last post by:
I want to play swf files in a page, I did it myself but the problem is that I didn't getting any controls like play, pause and stop. What are the necessary changes I have to made to achive that?
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.