Witajcie. Kompletnie nie znam się na js. Chciałem, aby na stronie co jakiś czas zmieniał się obiekt flash. Znalazłem taki kod, ale do obrazków. W kodzie źródłowym zmienia się adres obiektu, ale wizualnie tego nie widać. Chciłabym, aby przejście z 1 obiektu na 2 było płynne (np. jakieś animowane przejście do czerni).
Bardzo proszę o pomoc.

  1. var delay=100
  2. var curindex=0
  3.  
  4. var randomimages=new Array()
  5.  
  6. randomimages[0]="1.swf"
  7. randomimages[1]="2.swf"
  8. randomimages[2]="3.swf"
  9. randomimages[3]="4.swf"
  10. randomimages[4]="5.swf"
  11. randomimages[5]="6.swf"
  12.  
  13.  
  14. var preload=new Array()
  15.  
  16. for (n=0;n<randomimages.length;n++)
  17. {
  18. preload[n]=new Image()
  19. preload[n].src=randomimages[n]
  20. }
  21.  
  22. document.write('<embed name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(randomimages.length))]+'" width=1050 height=250px ></embed>')
  23.  
  24. function rotateimage()
  25. {
  26.  
  27. if (curindex==(tempindex=Math.floor(Math.random()*(randomimages.length)))){
  28. curindex=curindex==0? 1 : curindex-1
  29. }
  30. else
  31. curindex=tempindex
  32.  
  33. document.defaultimage.src=randomimages[curindex]
  34. }
  35.  
  36. setInterval("rotateimage()",delay)
  37.  
  38.  
  39. $(document).ready(function() {
  40. setInterval(function() {
  41. $.ajax({
  42. url: 'testhtml.html',
  43. dataType: 'text'
  44. });
  45. }, 100);
  46. });